Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function detectflash(){
- if (navigator.plugins != null && navigator.plugins.length > 0){
- return navigator.plugins["Shockwave Flash"] && true;
- }
- if(~navigator.userAgent.toLowerCase().indexOf("webtv")){
- return true;
- }
- if(~navigator.appVersion.indexOf("MSIE") && !~navigator.userAgent.indexOf("Opera")){
- try{
- return new ActiveXObject("ShockwaveFlash.ShockwaveFlash") && true;
- } catch(e){}
- }
- return false;
- }
- if(detectflash()){
- alert("Flash is enabled");
- } else{
- alert("Flash is not available");
- }
- <script type="text/javascript">
- <!--
- var MM_contentVersion = 9;
- 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" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="160" height="120">');
- document.write('<param name="movie" value="animation.swf">');
- document.write ('<param name="quality" value="high">');
- document.write ('<param name="wmode" value="transparent">');
- document.write('<embed src="animation.swf" width="160" height="120" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed></object>');
- } else{
- document.write('<a href="./"><img src="replaced-image.png" alt="Flash Plugin not Installed" border="0"></a>');
- }
- //-->
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement