开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜