如何关闭iframe? [英] How to close an iframe?

查看:157
本文介绍了如何关闭iframe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在打开iframe之后,我有时需要关闭它。到目前为止,我只是从其父节点删除iframe,从而将其从DOM中删除掉。但是,我发现这并不会立即终止iframe的生命,其JavaScript代码仍然可以回调到父窗口中,不再需要这些回调。

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.

如何杀死一个iframe死?我没有看到关闭或破坏方法。

How can I kill an iframe dead? I don't see a close or destroy method on it.

推荐答案

在您的网站上创建一个blank.htm文件。将IFrame SRC设置为blank.htm,然后删除IFRAME。

Create a blank.htm file on your site. Have the IFrame SRC set to the blank.htm, then remove the IFRAME.

这篇关于如何关闭iframe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆