Location href Property |
Updated: 2023-11-07
Category: JavaScript Reference
Definition and Usage
The href property returns the entire URL of the current page.
Syntax
location.href
Return Value
A string representing the full URL of the current page.
Example
This example displays the full URL of the current page in an alert box:
<script>
document.write("Full URL: " + location.href);
</script>
Related Pages
- Location protocol Property
- Location host Property
- Location port Property
- Location pathname Property
- Location search Property
- Location hash Property
YouTip