|
I was working on a template conversion recently and the client ask me if it's possible to differentiate between people who has Flash plug-in installed on their systems and others who don’t, basically to load a static image in place of the flash object used in the template when user doesn't have flash installed. which is perfect for sites that use flash heavily.
So I tested out a few scripts but I found this one to be small, quick and sweet so I decided to share my experience with you. please note that this script only works with major browsers and NOT 100% compatible with all browsers out there. use at your own risk.
click on "Read more" to continue
Add this script where you want flash to appear:
<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 ) { document.write('<OBJECT
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'); document.write('
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '); document.write(' ID="script" WIDTH="300"
HEIGHT="200" ALIGN="">'); document.write(' <PARAM NAME=movie
VALUE="script.swf"> <PARAM NAME=quality VALUE=high> <PARAM
NAME=bgcolor VALUE=#FFFFFF> '); document.write(' <EMBED
src="script.swf" quality=high bgcolor=#FFFFFF
'); document.write(' swLiveConnect=FALSE WIDTH="300" HEIGHT="200"
NAME="script" ALIGN=""'); document.write('
TYPE="application/x-shockwave-flash" PLUGINSPAGE="'">http://www.macromedia.com/go/getflashplayer">'); document.write('
</EMBED>'); document.write(' </OBJECT>'); }
else{ document.write('<IMG SRC="script.gif" WIDTH="300" HEIGHT="200"
usemap="#script"
BORDER=0>'); } //--> </script><NOSCRIPT><IMG
SRC="script.gif" WIDTH="300" HEIGHT="200" usemap="#script"
BORDER=0></noscript>
Replace script.swf with the
(templates/template_name/images/your_flash.swf) and script.gif
with (templates/template_name/images/your_image.gif) which will be displayed if
the user does not have Flash installed.
Also change the dimension of flash and the image (width and height)
Credits: http://www.kirupa.com/developer/mx/detection.htm
Please note that The author or Mambohut shall not be held liable for
any damages or losses caused by the code listed here. |
Written by visualdensity on 2004-04-02 07:43:21 Great stuff MO! Thanks! | Written by Guest on 2004-06-02 03:51:28 | Written by Guest on 2004-06-02 03:51:52 | Written by Guest on 2004-07-07 10:48:48 | Written by Guest on 2005-08-09 03:37:26 | Written by Guest on 2005-08-12 13:10:02 |
Only registered users can write comments. Please login or register. Powered by AkoComment 2.0! |