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">