How to use JavaScript to get the current URL
- Previous Page Get Current Date
- Next Page Get Current Screen Size
Learn how to use JavaScript to get the current URL.
Current URL
Usage window.location.href
Get the current URL address:
Example
document.getElementById("demo").innerHTML = "The full URL of this page is:<br>" + window.location.href;
Related Pages
Reference Manual:JavaScript window.location object
- Previous Page Get Current Date
- Next Page Get Current Screen Size