window.location - Object and
window.location.href is a property
It tells you the current location of the browser URL
document.write(location.href);
When setting the property will redirect the page.
window.open() is a method that you can pass the url you want to open in a new window
eg
window.location.href = 'http://www.xyz.com'; //Will take you to xyz.
window.open('http://www.xyz.com'); //This will open xyz in a new window.
Dipak ingole
source share