473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Hiding embed objects in Safari ?

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[i].type=="application/x-shockwave-flash")
document.embeds[i].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.

Jan 12 '07 #1
3 2449
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[i].type=="application/x-shockwave-flash")
document.embeds[i].style.visibility="hidden";
and trying something like :

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

variante :

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


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 12 '07 #2
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[i];
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.

Jan 12 '07 #3
ASM
dd a écrit :
it's the parent object tag that should
be targeted.
Je m'en doutais un peu.

It is certainly cleaner.

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 12 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Anna | last post by:
Hi all. I want to embed the EMBED tag in the object tag. I understood that I need to provide a PARAM tag inside the OBJECT whose value will hold the content of EMBED src attribute, but after...
6
by: Timo | last post by:
I don't know enough about the technology yet to know whether this is a ridiculous question-- but is there no cross-browser javascript implementation of XMLHTTP and SOAP for use in calling web...
3
by: Xah Lee | last post by:
what's HTML 4 standard's equivalent of the following? <embed src="souls.mid" autostart="false" width="500" height="20"> thanks. Xah xah@xahlee.org ∑ http://xahlee.org/
6
by: harrylmh | last post by:
Hi, I'm learning C# and I just don't quite understand the need for polymorphism. why do we need to use it? how does a base class variable holding a derived class instance do any good? Also,...
7
by: Haines Brown | last post by:
I'm trying to use a Shockwave Flash file as is except for a line of text that it displays. I'd like to hide that line of text, and so I tried to create a black mask to do it. However, I can't move...
2
by: nyluke | last post by:
If I embed a movie (Quicktime or anything) in a DIV and then use javascript to change the innerHTML of that DIV, the movie keeps playing invisibly (I can hear the audio) after the change. This...
25
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as...
9
by: dd | last post by:
Does anyone have a cross-browser solution for hiding scrollbars and/or disabling scroll for the whole page? When the user clicks something, I want to display a DIV that fills the whole client...
3
by: tn | last post by:
Hi, I have a test page at http://maroc.tribalnetworks.org/testmov.html I am trying to find a way to embed the video as simply as possible without specifying WMP or QuickTime player (or any...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.