kha*_*rah 9 javascript windows
window.location.href ()和window.open()方法有JavaScript什么区别?
Dip*_*ole 21
window.location是一个对象和
window.location.href是它的财产
它会告诉您浏览器的当前URL位置
document.write(location.href);// will give location URL location of browser.
Run Code Online (Sandbox Code Playgroud)
设置属性将重定向页面.
window.open()是一种方法,您可以将URL传递给要在新窗口中打开的URL
例如
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.