![](/img/trans.png)
[英]is it possible to close android/ios application webview using java script?
[英]Close ifreame using java script
如何使用javascript
關閉iframe
。我找到了一些方法來使用它
window.parent.close();
但這個方法關閉了整個標簽。但我需要的只是關閉iframe
。任何人都得到了解決方案?
iframe不是窗口,不能關閉。 您可以使用隱藏它
$(theIFrame).hide();
$(theIFrame).remove();
如果要隱藏或iframe的文檔中的腳本刪除的iframe,你必須先得到相關的元素。 你可以這樣做 :
var iframe = $(parent.document).find('iframe').filter(function() {
return this.src==location.href;
});
iframe.remove();
如果您不從iframe執行此操作,則應該有某種引用。 或者你也可以隨便做
$('iframe').remove();
你不能關閉iframe。
你必須用elem.removeChild(elem_iframe)
刪除節點
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.