I'm trying to write a javascript function that detects embedded objects. As the result of my 3 hour research i found that there are 2 major approach to use a .swf file in html
Object tag, example:
<object data="intro.swf" height="200" width="200"/>Embed tag, example:
<embed src="intro.swf" height="200" width="200"/>
But there is a third approach which is cross-browser and somehow more common:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
width="100"
height="100">
<param name="movie" value="sample.swf">
<param name="quality" value="high">
<embed src="sample.swf" quality="high" width="100" height="100"
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
I found a function here:
function getFlashMovieObject(movieName) {
if (window.document[movieName]) {
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet") == -1) {
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}
}
but this function takes the id/Name Attribute as argument,and is not good for me. I thought that it's better to detect browser first and then look for flash object. I'm still trying. What should I do to detect RENDERED flash object??
objects can be nested, so there may be anobjectdecendant of anobject. And of course,embeds are commonly used as children ofobjects. You need to filter that one out.