There are 2 ways to get the current URL from a browser using JavaScript. The main one is window.location.href and document.URL is an alternative option.

To check that both approaches are functional, you can use a simple alert to make show current browser URL with JS.


You can do the same for document.URL