IE10 / Safari cannot hide object / flash inside iFrame

I have Flash Animation inside an iFrame. And when I try to hide it, IE10 keeps it visible and overlaps other content. Here is an example .

<body style="background-color: #EEE"> Testing IE10 <div id="swfDiv"> <iframe src="swf.html" width="500" height="50"></iframe> <br /> <button onclick="document.getElementById('swfDiv').style.display='none'">Hide</button> </div> <div style="background-color: #DDD"> This try to hide the animation, but it is not working on IE10. <br/> It works fine in others browsers and earlier versions of IE. </div> </body> 

IE10

Update 08/02/2013 I found the same problem in Safari (5.1.7) enter image description here

+4
source share
2 answers

Apparently the best solution would be to switch from the screen:

 .xhide { display: block; position: absolute; left:-9999px; } 

We can add this class in a click to hide it, something like:

 document.getElementById('swfDiv').className = "xhide"; 
+5
source

Going to closing the iframe solved my problem on XBAP, I think it will work for flash as well.

 var $iframe = $("#id"); $iframe[0].src = 'about:blank'; $iframe.remove(); 
+1
source

All Articles