How do I use javascript or jQuery to close an iframe within iframe itself? I've tried <a href="javascript:self.close()">
but it didn't work.
window. close(); or this: top. window. close(); you should be able to close it.
Set the iframe to the appropriate width and height and set the scrolling attribute to "no". If the area you want is not in the top-left portion of the page, you can scroll the content to the appropriate area. Refer to this question: Scrolling an iframe with javascript?
"Closing" the current iFrame is not possible but you can tell the parent to manipulate the dom and make it invisible.
In IFrame:
parent.closeIFrame();
In parent:
function closeIFrame(){ $('#youriframeid').remove(); }
function closeWin() // Tested Code { var someIframe = window.parent.document.getElementById('iframe_callback'); someIframe.parentNode.removeChild(someIframe)); } <input class="question" name="Close" type="button" value="Close" onClick="closeWin()" tabindex="10" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With