开发者

What Javascript function is used to check for a certain browser plugin?

开发者 https://www.devze.com 2022-12-22 15:52 出处:网络
What Javascript fu开发者_高级运维nction is used to check for a certain plugin? Such as for Silverlight, Flash, Quake Live, Real Player...There are various ways:

What Javascript fu开发者_高级运维nction is used to check for a certain plugin? Such as for Silverlight, Flash, Quake Live, Real Player...


There are various ways:

if (navigator.plugins) {
  for (var i = 0; i < navigator.plugins.length; i++) {
    //blah blah blah
  }
} else if (navigator.mimeTypes) {
     var useFlash = navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
} else { //Usually IE crap....lol

}

Basically in summary:

  • navigator.plugins
  • navigator.mimeTypes

and For IE, check this site as example: http://www.rgagnon.com/jsdetails/js-0056.html

Apparently you can use VBScript to check plugins (only in IE).


"Use the mimeTypes property to see if the browser supports a particular MIME Type, such as application/x-shockwave-flash. If it does, you know that Flash Player is installed. "

http://www.adobe.com/support/flash/how/shock/javaplugs/javaplugs02.html

0

精彩评论

暂无评论...
验证码 换一张
取 消