[英]iFrame src change event
我使用了Iframe
來顯示另一個網站的登錄頁面。 當用戶輸入用戶名和密碼時,我希望與其在“ iframe”中打開結果登錄窗口,而要在其他窗口中打開。 我的解決方案是,當用戶登錄時,我使用當前URL:iframe“,如果與其SRC相反,則我的Windows位置等於” iframe“的當前URl
<iframe id="neturl" src="http://www.anotherSite.com/Login.aspx" onLoad="ChangeUrl();" ></iframe>
我使用javascript查找IFrame的Current url
,但是當我使用此腳本時,出現錯誤拒絕訪問屬性'href'的權限 。
function ChangeUrl()
{
var frame= document.getElementById('neturl');
alert(frame.src);
}
但是如何獲取當前網址或了解該網址已更改?
使用window.location.href
獲取當前網址。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.