admin管理员组文章数量:1313778
After opening an iframe, I sometimes need to close it. Thus far, I just remove the iframe from its parent node, thus cutting it off from the DOM. However, I'm finding that this doesn't immediately end the iframe's life, and its javascript code can still call back into the parent window, which no longer expects these callbacks.
How can I kill an iframe dead? I don't see a close or destroy method on it.
After opening an iframe, I sometimes need to close it. Thus far, I just remove the iframe from its parent node, thus cutting it off from the DOM. However, I'm finding that this doesn't immediately end the iframe's life, and its javascript code can still call back into the parent window, which no longer expects these callbacks.
How can I kill an iframe dead? I don't see a close or destroy method on it.
Share Improve this question asked Oct 26, 2009 at 17:56 Andrew ArnottAndrew Arnott 81.8k28 gold badges138 silver badges180 bronze badges3 Answers
Reset to default 7Create a blank.htm file on your site. Have the IFrame SRC set to the blank.htm, then remove the IFRAME.
if your using jQuery then you can use $.remove('iframe object id') method. This would remove the DOM object from the page and in this iframe would be removed.
try this..
<a href="Home.html" target="_parent">
本文标签: javascriptHow to close an iframeStack Overflow
版权声明:本文标题:javascript - How to close an iframe? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741957130a2407052.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论