Hiding embed objects in Safari ?

D

dd

Hi,

I have some code that hides all Flash objects on a page. It's working
fine on IE and Gecko but doesn't work on Safari. There are no errors
(shown in the console) when it runs on Safari, and when I alert the
properties they do show the correctly changed status, but the screen
doesn't reflect that. It maybe a bug in the Flash player for Safari
(I'm using player 9.0) which is just ignoring that it's been hidden.
Here is the Firefox/Safari part of my logic:

for(var i=0;i<document.embeds.length;i++)
if(document.embeds.type=="application/x-shockwave-flash")
document.embeds.style.visibility="hidden";

If I alert the visibility beforehand, it's set to "visible" and
afterwards it's set to "hidden", so clearly the code is doing what's
asked of it, but still the Flash continues to persist on-screen. I
tried a browser resize (with the mouse manually) and it still remained,
so it wasn't just a bad rendering issue. The Flash remains there and
remains animating and interactive. I've considered resizing it to zero
x zero but that may have page alignment issues if that embed was
filling a hole.

Ideas anyone? That code above works on all non-IE browsers I've tried
it on. The IE version of course looks through the objects array and
checks the classid but when it comes to hiding, does the same thing.
 
A

ASM

dd a écrit :
Hi,

I have some code that hides all Flash objects on a page. It's working
fine on IE and Gecko but doesn't work on Safari. There are no errors
(shown in the console) when it runs on Safari, and when I alert the
properties they do show the correctly changed status, but the screen
doesn't reflect that. It maybe a bug in the Flash player for Safari
(I'm using player 9.0) which is just ignoring that it's been hidden.
Here is the Firefox/Safari part of my logic:

for(var i=0;i<document.embeds.length;i++)
if(document.embeds.type=="application/x-shockwave-flash")
document.embeds.style.visibility="hidden";


and trying something like :

var O = document.getElementsByTagName('EMBED');
for(var i=0;i<O.length;i++)
if(O.type=="application/x-shockwave-flash")
document.body.removeChild(O);

variante :

var O = document.getElementsByTagName('EMBED');
for(var i=0;i<O.length;i++)
if(O.type=="application/x-shockwave-flash") {
var d = document.createElement('DIV');
d.width = O.width;
d.height = O.height;
d.style.width = O.style.width;
d.style.height = O.style.height;
d.className = O.className;
d.innerHTML = O.src;
document.body.replaceChild(d,O);
}
 
D

dd

Thanks ASM. I tried removeChild and Safari doesn't seem to like it
much. I would have pursued that but I just figured out this alternate
solution:

var obj_to_hide=document.embeds;
if( Safari && obj_to_hide.parentElement.tagName=="OBJECT")
obj_to_hide=obj_to_hide.parentElement;

obj_to_hide.style.visibility="hidden";

When it comes to hiding/showing, it's the parent object tag that should
be targeted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top