![](/img/trans.png)
[英]javascript : window.location.href/window.open is not working on iframe
[英]Window.location.href () and Window.open () in JavaScript
JavaScript
window.location.href ()
和window.open()
方法有什么區別?
window.location
是一個Object和
window.location.href
是它的屬性
它會告訴您瀏覽器的當前URL位置
document.write(location.href);// will give location URL location of browser.
設置屬性將重定向頁面。
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.
window.location.href
更改了即時窗口位置。
window.open()
將打開一個新窗口。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.