2009-11-13 42 views
2

我有一個域包含一個iframe與來自另一個域的內容。這個iframe裏面有_top鏈接。在IE6上,當你點擊它們時,什麼都不會發生。我準備了一個這樣的最簡單的例子。請使用IE6去http://www.bemmu.com/static/top.html試試。IE6 _top鏈接域內的iframe

編輯:這似乎只發生,如果安全級別爲「高」(或者自定義),它是在默認情況下在我的IE瀏覽器上全新安裝來源http://www.bemmu.com/static/top.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd"> 
<html> 
    <body> 
     <iframe src="http://bemmu4.appspot.com/static/iframe.html"/> 
    </body> 
</html> 

來源http://bemmu4.appspot.com/static/iframe.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd"> 
<html> 
    <body> 
     <a href="http://www.google.com" target="_top">Let's go to Google!</a> 
    </body> 
</html> 

有沒有辦法讓這些_top鏈接工作?

回答

2

我沒有在我的機器上安裝IE6,但我認爲你可以嘗試iframe中的一個小竅門,在你的錨標記中設置一個onclick屬性爲window.top.location.href='http://www.google.com';。它工作嗎?

+0

哇,你打我9秒鐘:) :) – JasonWyatt 2009-11-13 21:24:50

+0

儘管你給出了更多的解釋代碼相同的答案。 :)但是,當幾分鐘結束時,沒有人會看到我的第一個。 – GmonC 2009-11-13 21:28:50

+0

嗯,我看着兩個同樣:)而且都沒有工作。那麼,我想我可以生活沒有解決方案,IE6上的高安全模式似乎是非常嚴格的,甚至不允許document.write或alert() – Bemmu 2009-11-13 22:16:57

1

它是否適合您使用類似的東西?

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd"> 
<html> 
    <body> 
     <a href="http://www.google.com" target="_top" onclick="javascript:if(window.top){window.top.location='http://www.google.com';}">Let's go to Google!</a> 
    </body> 
</html>
+0

好主意,但不起作用。它直接從頁面工作,但不是在iframe內工作。 – Bemmu 2009-11-13 22:07:44