Search w3schools.com:

SHARE THIS PAGE

Location href Property

Location Object Reference Location Object

Definition and Usage

The href property returns the entire URL of the current page.

Syntax

location.href


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The href property is supported in all major browsers.


Example

Example

Return the entire URL (of the current page):

<script>

document.write(location.href);

</script>

The output of the code above will be:


Try it yourself »


Location Object Reference Location Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]