views:

317

answers:

1

I want to find all flash objects on a random page (to make them wmode=transparent so they wont hide a menu).

IE does not support EMBED in: document.getElementsByTagName("EMBED");

Any idea what is the most efficent to find all embeds (no jQuery...)

Also for the more advanced: I came across sites where the embed tag was written as eMBED. I need to find these kind of tags also.

Thanks

+2  A: 

I think the problem is not that IE does not support a search on <embed> tags but rather that in IE one uses <object> tags to include a flash element. As a matter of fact, Firefox also supports the latter format, if you use the following form:

<object type="application/x-shockwave-flash" data="MyFlashProgram.swf">

In fact, this is the preferred syntax, and swfobject uses this as well. So, for a cross-browser solution, you'd need to look for:

  • <embed> and <object> elements with type attribute set to "application/x-shockwave-flash"
  • <object> elements with classid attribute set to "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

Im unsure about other browsers like Opera or Safari, it is possible that you need to extend this list with further variants.

Finding these elements should be trivial with a javascript library like jQuery or prototype, but you can manage without those.

David Hanak