Learn how to get the current URL with JavaScript.
Current URL
Use window.location.href to get the current URL address:
Example
js
document.getElementById("demo").innerHTML =
"The full URL of this page
is:<br>" + window.location.href;
Read more about the
window.locationobject in the JavaScript Window Location Tutorial.