lhyman
New Member
- Messages
- 198
- Reaction score
- 0
- Points
- 0
This script will autodetect if you have a flash plugin installed in your browser and redirect you to a flash page or a non flash page.
This is usefull if you have some flash pages and you connect to your site with a non-flash device (like an Ipod Touch for example) and you would like the redirection done automactily.
To use the script, you need 3 html pages. One page that contains the script and the other two pages to be redirected to.
step 1:
Page 1 - loader.htm
Place the script between:
<head>
(place script here)
</head>
step 2:
change the URL's in the script
step 3:
call up loader.htm with your pc and see if you get redirected to the flash page
step 4:
call up loader.htm with you non flash device or browser and see that you get redirected to the non flash page.
Here is the script:
If you need any help, just let me know.
This is usefull if you have some flash pages and you connect to your site with a non-flash device (like an Ipod Touch for example) and you would like the redirection done automactily.
To use the script, you need 3 html pages. One page that contains the script and the other two pages to be redirected to.
step 1:
Page 1 - loader.htm
Place the script between:
<head>
(place script here)
</head>
step 2:
change the URL's in the script
step 3:
call up loader.htm with your pc and see if you get redirected to the flash page
step 4:
call up loader.htm with you non flash device or browser and see that you get redirected to the non flash page.
Here is the script:
Code:
<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
window.location.replace("[URL]http://www.yoursite.com/flash.htm[/URL]");
} else{
window.location.replace("[URL]http://www.yoursite.com/noflash.htm[/URL]");
}
//-->
</SCRIPT>
If you need any help, just let me know.