JavaScript gives you many ways to access and change the current URL that is displayed in the visitor’s browser. All these techniques use the Location
object, which is itself a property of the Window
object. You can create a new Location
object that contains the current URL as follows:
var currentURL = window.location;
In this tutorial, you explore all the properties and methods of the Location
object. You learn:
- How to read all the different parts of a URL
- How to send the visitor to another page by changing the URL, and
- How to automatically reload or refresh the page.
[Read more…] about Using Javascript’s Location Object to Work with URLs