Hi all and happy Easter or Passover to anyone who celebrates either. I've just finished working on an alternative solution to this issue, which _uses_ JavaScript, but doesn't actually _require_ it...
It goes like this. I noticed that some of the solutions out there involve replacing the outerHTML of the div that contains the script to generate the flash ActiveX. So I thought - what would happen if you started off with an <objet> tag, and then replaced the outerHTML with itself??? Well, it turned out to be slightly more complicated than that, but not by much. The outerHTML value omits the param tags, which are pretty much essential. But with a few lines of code you can reconstruct the object and replace the outerHTML with pretty much the same outer HTML. Sounds crazy? I didn't even think it would work, but it was worth a try! You can see it at work on my website - www.neo-archaic.net on the home page and the gallery page. I think it still has a few short comings and could also do with some browser and flash detection. Also, it does a little jump from the original to the flash version, which I need to have a think on (hmm... Start with the object invisible and show it after it's been replaced?). In any case, I'm very interested in what you think about it, and any ideas on how to improve this. ----------------- Here's the code: //Replace all flash objects on the page with the same flash object, //by rewriting the outerHTML values //This bypasses the new IE ActiveX object activation issue replaceFlash = function(){ //Get a list of all ActiveX objects var objects = document.getElementsByTagName('object'); for (var i=0; i<objects.length; i++){ var d = objects[i] //This is only tested with flash, so ignore all other types //The object must therefore have the attribute type="application/x-shockwave-flash" if (d.type != "application/x-shockwave-flash"){ continue; } //Get the tag and attributes part of the outer html of the object var tag = d.outerHTML.split(">")[0] + ">" //The outer html omits the param tags, so we must retrieve and insert these seperately var lst = d.getElementsByTagName('param') var params = "" for (var j = 0; j<=lst.length; j++) { if (lst[j] != null){ params += lst[j].outerHTML } } //Add up the various bits that comprise the object: //The tag with the attributes, the params and it's inner html var newObject = tag + params + d.innerHTML + " </OBJECT>" //And rewrite the outer html of the tag d.outerHTML = newObject } } ------------------ Here's an example object: <object data="flash/home.swf" type="application/x-shockwave-flash" codebase="http://www.neo-archaic.net/index_old.html" width="620" height="350"> <param name="movie" value="flash/home.swf" /> <param name="wmode" value="transparent" /> <param name="quality" value="best" /> <p> Alternative text </p> </object> ------------------- Note that I'm using an alternative object tag, that doesn't have the classid, codebase etc. This is a standards compliant way of handling this, doesn't require an embed tag to work on Mozilla etc., shows the alternative text if flash is not enabled, and is incredibly ligthweight. So... What do you guys think? Karina Karina Steffens | Neo-Archaic creative & technical new media design www.neo-archaic.net _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com