[SWFObject] Opera and Firefox

Chris Colman chrisc at stepaheadsoftware.com
Wed Aug 16 01:21:08 PDT 2006


Ok, I've now come up with a better approach than my last attempt for
handling cases where NO Flash player is installed. It has the following
behaviour:
 
1.	Works generically - ie., the http link doesn't have to be
tailored for each page that it appears in - it's generated by
javascript.
2.	Requires the user to click on the "Install Flash" link - which
typically will not happen very often so not such a problem.
3.	Does not add detectflash=false parameter to URL when the flash
player is installed and working fine (unlike my previous solution!)
4.	Automatically chooses the correct delimiter (? Or &) based on
whether the URL already has parameters or not.
 
I just add the following code within the <div> where the movie is to go:
     <script type="text/javascript">
                 // determine the type of delimiter required
                 var delimiter=(document.location.search.indexOf("?")<
0) ? "?":"&"; 
                 
                 // write out the link with the detectflash=false param
appended
                 document.writeln("<a
href=\""+document.URL+delimiter+"detectflash=false\">Install
Flash</a>");
     </script>
 
We'll be enhancing the AnFX Flash animation tool so that all HTML
generated by AnFX will output the above additional Javascript so that
the correct "bypass detect" link will be displayed. The link displayed
will be "Install Flash" instead of "bypass Flash detection" because in
my opinion it is more user friendly. The new AnFX release should be
available within a couple of days.
 
Chris
 
 
 
 
Chris
 
quickly looking through the swfObject code, you can see that you can set
it as the last param in the constructor:
 
deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall,
quality, xiRedirectUrl, redirectUrl, detectKey)
 
which means you should be able to do something like:
 
var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7",
"#336699", false, "high", "", "", false);
so.write("flashcontent");
 
I actually tried that but on reading of the SWFObject source code
realized that the detectKey parameter is used to specify an alternate
name for the detechflash parameter. It doesn't actually specify the
value of the detectflash parameter.
 
I've done a bit of a crazy thing and actually added, via javascript,
code that sets the detechflash variable from within the HTML file itself
but it is not a desirable solution: the URL now always appears with the
?detectflash=false parameter which doesn't look good. Here's the code if
you're interested:
 
I either can add this to the main body of the page or within the <div
id=mymovie> but either way the URL in the address bar gets
detectflash=false - even when Flash is installed.
 
<script type="text/javascript">
         var addStr="";
         if (window.location.search.length>0)
         {
                     if
(window.location.search.indexOf("detectflash")<0)
                     {
                                 addStr = "&detectflash=false";
                     }
         }
         else
                     addStr="?detectflash=false";
                     
         if (addStr.length!=0)
         {
                     window.location.search+=addStr;
                     addStr="";
         }
         //document.writeln(window.location.search);
</script>
 
I need something that's very generic because we produce an animation
product that generates SWFs and so we don't know what the user's final
URL is going to be, This makes it hard to generate the HTML tag with the
correct "ByPass flash detect link".
 
Maybe there is a way to use javascript to generate the correct link heh?
Now there's a good idea! I might try that.
 
I am actually unsure as what to pass in for the no value xiRedirectUrl
and redirectUrl values without testing it, but if it is not an empty
string (as above), then you should be able to pass in null.
 
var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7",
"#336699", false, "high", null, null, false);
 
Geoff, any quick clarification you can add to this?
 
 
Cheers,
Aran
	 
	
________________________________

	From: swfobject-bounces at lists.deconcept.com
[mailto:swfobject-bounces at lists.deconcept.com] On Behalf Of Chris Colman
	Sent: Wednesday, 16 August 2006 3:57 PM
	To: swfobject at lists.deconcept.com
	Subject: Re: [SWFObject] Opera and Firefox
	How do I get the effect of detectflash=false without having to
make sure the page was requested with the ?detectflash=false parameter?
	 
	Chrisco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deconcept.com/pipermail/swfobject-deconcept.com/attachments/20060816/ff82aa2b/attachment-0005.htm>


More information about the Swfobject mailing list