One of hundreds of answers available with our premium content service.
A: The URL of the current page is represented by the Javascript window.location object. There are several components to the location object that represent parts of the URL. The relative URL of the page is given by the location.pathname property, plus any query or "search" part and fragment identifier or "hash". Not all URLs include a query and fragment identifier, so these properties may be null and need to be checked, as below.
… full answer hidden
Premium members click below for full answer
How can I get the relative URL of a page?
Your premium content subscription is a single payment that gives you: