window.location.href = 'URL';
is the standard implementation for changing the current window’s location.
document.location is a (deprecated but still present) read-only string property, replaced by document.url.
window.location also affects to the frame,
the best form i found is:
And the worse is:
I did a massive browser test, and some rare IE with several plugins get undefined with the second form.
window.location will affect to your browser target.
document.location will only affect to your browser and frame/iframe.
window.navigate not supported in some browser
In java script many ways are there for redirection, see the below code
window.location.href = "http://krishna.developerstips.com/"; window.location = "http://developerstips.com/"; window.location.replace("http://developerstips.com/"); window.location.assign("http://work.developerstips.com/");
window.location.href loads page from browser’s cache and does not
always send the request to the server. So, if you have an old version
of the page available in the cache then it will redirect to there
instead of loading a fresh page from the server.
window.location.assign() method for redirection if you want to allow
the user to use the back button to go back to the original document.
window.location.replace() method if you want to want to redirect to a
new page and don’t allow the user to navigate to the original page
using the back button.
window.navigate is NOT supported in some browsers, so that one should be avoided. Any of the other methods using the location property are the most reliable and consistent approach