1
我在我的頁面中使用iframe
來顯示來自外部網站的內容,但有時候iframe會將整個頁面重定向到新的位置,這會在我的網站上產生不需要的東西。找到重定向網址
是否有可能找到iframe
將重定向我的網站的頁面?如果是這樣,給我一個關於如何找到這個重定向地址的基本例子。我想在新標籤頁中打開此地址,因爲此地址的信息可能對我的用戶有用。
www.b.com [摘要代碼]:
if(somethingHappens) window.top.location.href = "http://google.com";
www.a.com [摘要代碼]:
<!-- code -->
<iframe src="http://www.b.com"></iframe>
<!-- code -->
預期結果[摘要代碼]:
if(pageIsBeingRedirected) {
stopRedirection();
var url = findRedirectAddres(); // expected : http://google.com
window.open(url, "_blank");
return;
}
請在此提供一些HTML – 2012-10-14 13:28:29