I have an HTML page that opens an IFRAME … But at some point, after some user interactions with the IFRAME, it should close itself. I’ve tried various commands such as:
var fram = $("IFRAME_NAME");
fram.parentNode.removeChild(fram);
this.remove();
this.style.display='none';
var frame = parent.frames['IFRAME_NAME'];
frame.remove();
frame.html("");
document.IFRAME_NAME.document.body.innerHTML = '';
Thanks.
Considering markup like this:
The following jQuery code will remove it in the host page:
To close the iframe from within iframe itself, define the function in the host page:
Then in the code running in the iframe, call: