[SWFObject] javascript detection with swfobject

Guillaume derzeter at gmail.com
Tue May 30 06:15:56 PDT 2006


Hi,

Ive been using swfobject, which is very handy - And i have been asked to do
some flash detection (for people coming with a Flash 7 player, to play Flash
8 swfs) - in Javascript, for various reasons from my manager. Since when you
put into SWFObject() the parameter to write for a flash "8" swf, if someone
(under IE or firefox) got Flash Player 7, it will not write anything into
the "Flashcontent" div, here is my kind of solution , and at least compared
to scripts you can find here and there, this one looks to work well with
ffox.

<script>
function returnobj(id) {
  if (document.getElementById) {
    return document.getElementById(id);
  } else if (document.all) {
    return document.all[id];
  } else if (document.layers) {
    return document.layers[id];
  } else {
    return false;
  }
}


function didFlashWork()
{

var target = returnobj("Flashcontent");

if(target) {
if(target.innerHTML.length<2) {

 target.innerHTML = "Sorry you do not have flash player/the good version of
flash player.. please see <a href='http://www.adobe.com'>Here</a> to dl a
flash player..";

}

}

}

</script>



(...)

<html>

<body>

<script type="text/javascript" src="swfobject.js"></script>

<div id="Flashcontent"></div>
var so = new SWFObject("test.swf","mymovie", 200, 200, "8", "#000000");

so.write("Flashcontent");
didFlashWork();
</script>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deconcept.com/pipermail/swfobject-deconcept.com/attachments/20060530/2d59e902/attachment-0004.htm>


More information about the Swfobject mailing list