How to close iframe?

After opening an iframe, I sometimes need to close it. So far, I have simply removed the iframe from the parent node, thereby clipping it from the DOM. However, I found that this did not immediately end the life of the iframe, and its javascript code could still return to the parent window, which no longer expects these callbacks.

How can I kill an iframe? I do not see a method of closure or destruction.

+4
source share
3 answers

Create a blank.htm file on your website. Set IFrame SRC to blank.htm, then uninstall IFRAME.

+7
source

if you use jQuery then you can use the $ .remove ('idrame object id') method. This will remove the DOM from the page, in which case the iframe will be deleted.

0
source

try it.

<a href="Home.html" target="_parent"> 
0
source

All Articles