Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. function detectflash(){
  2. if (navigator.plugins != null && navigator.plugins.length > 0){
  3. return navigator.plugins["Shockwave Flash"] && true;
  4. }
  5. if(~navigator.userAgent.toLowerCase().indexOf("webtv")){
  6. return true;
  7. }
  8. if(~navigator.appVersion.indexOf("MSIE") && !~navigator.userAgent.indexOf("Opera")){
  9. try{
  10. return new ActiveXObject("ShockwaveFlash.ShockwaveFlash") && true;
  11. } catch(e){}
  12. }
  13. return false;
  14. }
  15.  
  16. if(detectflash()){
  17. alert("Flash is enabled");
  18. } else{
  19. alert("Flash is not available");
  20. }
  21.  
  22. <script type="text/javascript">
  23. <!--
  24. var MM_contentVersion = 9;
  25. var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  26. if ( plugin ) {
  27. var words = navigator.plugins["Shockwave Flash"].description.split(" ");
  28. for (var i = 0; i < words.length; ++i)
  29. {
  30. if (isNaN(parseInt(words[i])))
  31. continue;
  32. var MM_PluginVersion = words[i];
  33. }
  34. var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
  35. }
  36. else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
  37. && (navigator.appVersion.indexOf("Win") != -1)) {
  38. document.write('<SCR' + 'IPT LANGUAGE=VBScript> n'); //FS hide this from IE4.5 Mac by splitting the tag
  39. document.write('on error resume next n');
  40. document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))n');
  41. document.write('</SCR' + 'IPT> n');
  42. }
  43. if ( MM_FlashCanPlay ) {
  44. 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">');
  45. document.write('<param name="movie" value="animation.swf">');
  46. document.write ('<param name="quality" value="high">');
  47. document.write ('<param name="wmode" value="transparent">');
  48. 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>');
  49. } else{
  50. document.write('<a href="./"><img src="replaced-image.png" alt="Flash Plugin not Installed" border="0"></a>');
  51.  
  52. }
  53. //-->
  54.  
  55. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement