I want to get the complete URL in
When I hit https://www.abc.com/#section-1, currently
args.RequestUrl is not returning the section path. How to get complete URL with section after #.
var anchorValue; var url = document.location; var strippedUrl = url.toString().split("#");//or use window.location.hash if(strippedUrl.Length > 1) anchorvalue = strippedUrl;
Anchor tags (ex:
#my-anchor) aren't considered part of a URL and are not sent to servers. You can read more here: https://stackoverflow.com/questions/3067491/is-the-anchor-part-of-a-url-being-sent-to-a-web-server
For example, see this page: https://www.w3.org/TR/html401/struct/links.html
Click around on the table contents links. Notice that additional requests are not made to the server. They are meant to be used as `"jump links".
If you want to expose the anchor to the server, consider serializing it as a query string:
?my-anchor=anchor-name. From there it's business as usual on the server side: