finding plugins in IE


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var plugins = {
  2. hasAcrobat:function() {
  3. if (!window.ActiveXObject) return false;
  4. try { if (new ActiveXObject('AcroPDF.PDF')) return true;}
  5. catch (e) {}
  6. try { if (new ActiveXObject('PDF.PdfCtrl')) return true;}
  7. catch (e) {}
  8. return false;
  9. },
  10. hasFlash: function() {
  11. if (!window.ActiveXObject) return false;
  12. try {if (new ActiveXObject('ShockwaveFlash.ShockwaveFlash')) return true;}
  13. catch (e) { return false;}
  14. },
  15. hasJava: function() {
  16. return (!navigator.javaEnabled());
  17. },
  18. hasQuickTime: function() {
  19. if (!window.ActiveXObject) return false;
  20. try { if (new ActiveXObject('QuickTime.QuickTime')) return true;}
  21. catch (e) {}
  22. try {if(new ActiveXObject('QuickTimeCheckObject.QuickTimeCheck')) return true;}
  23. catch (e) {};
  24. return false;
  25. },
  26. hasRealPlayer: function() {
  27. if (!window.ActiveXObject) return false;
  28. var definedControls = [
  29. 'rmocx.RealPlayer G2 Control',
  30. 'rmocx.RealPlayer G2 Control.1',
  31. 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',
  32. 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',
  33. 'RealPlayer'
  34. ];
  35. for (var i = 0; i < definedControls.length; i++) {
  36. try {if(new ActiveXObject(definedControls[i])) return true;}
  37. catch (e) {continue;}
  38. }
  39. return false;
  40. },
  41. hasShockwave: function() {
  42. if (!window.ActiveXObject) return false;
  43. try {if(new ActiveXObject(’SWCtl.SWCtl’)) return true;}
  44. catch (e) {return false;}
  45. },
  46. hasWMP: function() {
  47. if (!window.ActiveXObject) return false;
  48. try {if(new ActiveXObject(’WMPlayer.OCX’)) return true;}
  49. catch (e) { return false;}
  50. }
  51. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.