JavaScript Demo - URLing, URL-Related Properties and Methods

Return to the JavaScript Demos Page

window.location Properties


history
Property


URL-Related document Properties


Details

window.location Properties:


Q: Why do you use "window.location" when just "location" will work?

A: It'll work in many contexts. However, it is possible that custom JavaScript code might contain a variable also called "location," and depending upon scope that variable could be used when you actually wanted to use window.location.


window.location and other window Methods:

While we're at it, window.location and window have some methods you can use:


history Property:

Note: The history object has several properties, but only one is generally available in an unsecure environment:


history Methods:


URL-Related document Properties:

If you look at the document.readyState value shown above, it should be shown as "loading" even though by now the document should be completely loaded. This is because the script that reads the value is inlined with the HTML markup and is executed when the markup is processed. For comparison, click the link to run another script that will read the value right now display it below:

Check document.readyState

 


Return to the JavaScript Demos Page