Plugin To Detect Flash in SiteCatalyst

I was reading a post earlier today on the Omniture Industry Insights site about Flash version detection. In the post, Technical Writer extraordinaire Ben Gaines explains a few methods on how to ‘detecting the version of Adobe Flash Player that visitors have installed in their browsers’. He states there are many methods readily available by doing a simple search, and there are. If you don’t have the skills or patience to hunt around for a way to grab the flash version, let me serve on right up on a silver platter for you. Behold, the Flash Detection plugin.

In your s_code file, add the following call to populate the sprop or evar of your choice

s.prop9=s.getFlash('s_fv');
	if(!s.prop9){
		s.detectFlash('s_fv','10');
		s.prop9=s.getFlash('s_fv');
	}

Then down in the plugin’s section, add the following code

/*
 * Plugin: Flash Detection 0.6 - Detect Flash version number
 */
s.detectFlash=new Function("cn","mfv","vr",""
+"var s=this,fv=-1,dwi=0,r,w,mt=s.n.mimeTypes,fk=s.c_r(cn),k=s.c_w('s"
+"_cc','true',0)?'Y':'N';if(k=='Y'&&!fk){if(s.pl&&s.pl.length){if(s.p"
+"l['Shockwave Flash 2.0'])fv=2;x=s.pl['Shockwave Flash'];if(x){fv=0;"
+"z=x.description;if(z)fv=z.substring(16,z.indexOf('.'));}}else if(mt"
+"&&mt.length){x=mt['application/x-shockwave-flash'];if(x&&x.enabledP"
+"lugin)fv=0;}if(fv<=0)dwi=1;w=s.u.indexOf('Win')!=-1?1:0;if(dwi&&s.i"
+"sie&&w&&execScript){result=false;for(var i=mfv;i>=3&&result!=true;i"
+"--){execScript('on error resume next: result = IsObject(CreateObjec"
+"t(\"ShockwaveFlash.ShockwaveFlash.'+i+'\"))','VBScript');fv=i;}}r=f"
+"v==-1?'flash not detected':fv==0?'flash enabled (no version)':'flas"
+"h '+fv;s.c_w(cn,r,0);return 'true';}else return '';");
s.getFlash=new Function("cn",""
+"var s=this;if(cn&&s.c_r(cn))return s.c_r(cn);");
s.returnFlash=new Function("cn","vr","to",""
+"setTimeout(\"var cn,vr,to,s_dfv=s_gi(s_account);s_dfv.linkTrackVars"
+"=vr,s_dfv.vr=s.getFlash();s_dfv.tl(this,'o','Flash Version Detectio"
+"n')\",to);");

If you have the SiteCatalyst debugger, go ahead and fire it up right now and you will see that I have this plugin enabled here populating s.prop9.

Enjoy!

Leave a Reply