Friday, July 31, 2009

How do you redirect visitors that don't have Flash to a non-flash version of a website?

I only want users who don't have flash to be redirected to the non-flash version. Everyone with flash will see the site in flash as it is.

How do you redirect visitors that don't have Flash to a non-flash version of a website?
%26lt;script language="JavaScript" type="text/JavaScript"%26gt;


%26lt;!--


function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0


var ok=false; document.MM_returnValue = false;


with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins %26amp;%26amp; plugins.length)) {


ok=(plugins %26amp;%26amp; plugins[plgIn]);


} else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1


if (plgIn.indexOf("Flash")!=-1 %26amp;%26amp; window.MM_flash!=null) ok=window.MM_flash;


else if (plgIn.indexOf("Director")!=-1 %26amp;%26amp; window.MM_dir!=null) ok=window.MM_dir;


else ok=autoGo; }


if (!ok) theURL=altURL; if (theURL) window.location=theURL;


}


//--%26gt;


%26lt;/script%26gt;


%26lt;body onLoad="MM_checkPlugin('Shockwave Flash','Flash.htm','NoFlash.htm',false);... document.MM_returnValue"%26gt;


%26lt;/body%26gt;


%26lt;script name="Used by MM_checkPlugin" language="javascript"%26gt;


%26lt;!--


with (navigator) if (appName.indexOf('Microsoft')!=-1 %26amp;%26amp; appVersion.indexOf('Mac')==-1) document.write(''+


'%26lt;scr'+'ipt language="VBScript"%26gt;\nOn error resume next\n'+


'MM_dir = IsObject(CreateObject("SWCtl.SWCtl.1"))\...


'MM_flash = NOT IsNull(CreateObject("ShockwaveFlash.Shoc...


//--%26gt;


%26lt;/script%26gt;





If they have flash it directs them to Flash.htm if they dont have flash it directs them to NoFlash.htm Hope it helps. If it doesnt work cuz yahoo screwed it up let me know and I can like zip it and email it but I dont think it screwed it up from what im seeing.
Reply:You could also use swfobject to do this on one page. It is a javascript that displays the flash content on computers that are flash enabled and alternative content on computers that are not. Check it out here : http://code.google.com/p/swfobject/


No comments:

Post a Comment