最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to close an iframe? - Stack Overflow

programmeradmin1浏览0评论

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 badges
Add a ment  | 

3 Answers 3

Reset to default 7

Create 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">
发布评论

评论列表(0)

  1. 暂无评论