Posted By

stephcode on 03/17/11


Tagged

flash detection sniffer


Versions (?)

Flash Detection Scripts


 / Published in: JavaScript
 

URL: http://www.kirupa.com/developer/mx/detection.htm

  1. Flash Detect: Flash Page or No-Flash Page
  2.  
  3. <SCRIPT LANGUAGE=JavaScript1.1>
  4. <!--
  5. var MM_contentVersion = 6;
  6. var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  7. if ( plugin ) {
  8. var words = navigator.plugins["Shockwave Flash"].description.split(" ");
  9. for (var i = 0; i < words.length; ++i)
  10. {
  11. if (isNaN(parseInt(words[i])))
  12. continue;
  13. var MM_PluginVersion = words[i];
  14. }
  15. var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
  16. }
  17. else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
  18. && (navigator.appVersion.indexOf("Win") != -1)) {
  19. document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
  20. document.write('on error resume next \n');
  21. document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
  22. document.write('</SCR' + 'IPT\> \n');
  23. }
  24. if ( MM_FlashCanPlay ) {
  25. window.location.replace("http://www.kirupa.com/flash.htm");
  26. } else{
  27. window.location.replace("http://www.kirupa.com/noflash.htm");
  28. }
  29. //-->
  30.  
  31. </SCRIPT>
  32.  
  33.  
  34. Flash Detect: Image or Animation
  35.  
  36. <SCRIPT LANGUAGE=JavaScript1.1>
  37. <!--
  38. var MM_contentVersion = 6;
  39. var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
  40. if ( plugin ) {
  41. var words = navigator.plugins["Shockwave Flash"].description.split(" ");
  42. for (var i = 0; i < words.length; ++i)
  43. {
  44. if (isNaN(parseInt(words[i])))
  45. continue;
  46. var MM_PluginVersion = words[i];
  47. }
  48. var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
  49. }
  50. else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
  51. && (navigator.appVersion.indexOf("Win") != -1)) {
  52. document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
  53. document.write('on error resume next \n');
  54. document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
  55. document.write('</SCR' + 'IPT\> \n');
  56. }
  57. if ( MM_FlashCanPlay ) {
  58. document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
  59. document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
  60. document.write(' ID="script" WIDTH="300" HEIGHT="200" ALIGN="">');
  61. document.write(' <PARAM NAME=movie VALUE="script.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> ');
  62. document.write(' <EMBED src="script.swf" quality=high bgcolor=#FFFFFF ');
  63. document.write(' swLiveConnect=FALSE WIDTH="300" HEIGHT="200" NAME="script" ALIGN=""');
  64. document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
  65. document.write(' </EMBED>');
  66. document.write(' </OBJECT>');
  67. } else{
  68. document.write('<IMG SRC="script.gif" WIDTH="300" HEIGHT="200" usemap="#script" BORDER=0>');
  69. }
  70. //-->
  71. </SCRIPT><NOSCRIPT><IMG SRC="script.gif" WIDTH="300" HEIGHT="200" usemap="#script" BORDER=0></NOSCRIPT>

Report this snippet  

You need to login to post a comment.