最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to check with JS if flash is installed, or not? - Stack Overflow

programmeradmin1浏览0评论

How to check with JS if flash is installed, or not? I don't want to detect the version, or other informations. I want to check only, if it's avaiable, or not.

The swfobject library makes it (and many other things, which are unneccessary for that), but I don't want to use a library for only one function.

How to check with JS if flash is installed, or not? I don't want to detect the version, or other informations. I want to check only, if it's avaiable, or not.

The swfobject library makes it (and many other things, which are unneccessary for that), but I don't want to use a library for only one function.

Share Improve this question asked Mar 22, 2012 at 12:41 Danny FoxDanny Fox 40.8k29 gold badges71 silver badges96 bronze badges 1
  • There is better solution to this. stackoverflow./questions/998245/… – Prakash Commented Dec 2, 2014 at 21:14
Add a ment  | 

2 Answers 2

Reset to default 9

If you’re using Flash to progressively enhance a document, please use this script to feature detect it first.

var hasFlash = ((typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") || (window.ActiveXObject && (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) != false));

hasFlash will be true if Flash is available, or falsy if it isn’t.

If you already have access to the Flash element you want to use then you could just do:

var hasFlash = 'Pan' in element;

Source: https://gist.github./675496

You can check if Flash is installed (see Mathias answer) but be aware that even if Flash is installed is still may be disabled (see here for examples http://blog.lroot./articles/techniques-to-easily-disable-flash-in-firefox-and-ie/) so your movies won't play at all.

发布评论

评论列表(0)

  1. 暂无评论