簡體   English   中英

使用JavaScript在iframe中更改加載值

[英]Change onload value within iframe using javascript

我在somepage.html中有一個名為somepage.html的頁面,而在somepage.html中是iframe的頁面somepage.html的源是

<body><iframe src="otherpage.html name="frame"></body>

otherpage.html的來源是

<body onload="somefunction()" onunload="otherfunction" >the other content here</body>

我想禁用onload功能而不觸摸otherpage.html(iframe)的代碼。 我想在somepage.html上禁用它

在IE中,您可以使用security =“ restricted” 屬性 它不會執行您想要的操作(完全禁用javascript),但是應強制IFRAME在其他區域中運行並阻止其訪問您的頁面。

實施時,HTML 5沙箱屬性也可能與您要尋找的屬性很接近。 特別是allow-scripts 現在,您只需要在大多數用戶的瀏覽器中實現它即可;)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM