vimal kumar
vimal kumar

Reputation: 75

How to close an iframe window?

hi every one now i am working on Iframe the problem is the iframe doesn't close completely,while reloading the page iframe is running on the background and i am unable to access the pages after reloading its because of iframe button which makes me trouble in accessing the page.

i have attached my iframe code below suggest me the possible solutions.

<div class="top" onclick="removeIFrame();"></div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">New Message</h4>
      </div>
      <div class="modal-body">
        <iframe id="templatesrc" name="templatesrc" src="?do=manualupgrade&id=<AJDF:output>$smarty.get.id</AJDF:output>" width="690" height="400" frameborder="0"></iframe>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>            
      </div>
    </div>
  </div>
</div>

Upvotes: 0

Views: 6189

Answers (1)

Thanga
Thanga

Reputation: 8101

In your page add the below code

<script>
function removeIFrame(){
document.getElementById("templatesrc").remove();
}
</script>

This will completely remove iframe.

Upvotes: 2

Related Questions