Kin*_*tor 88 javascript flash asp.net-mvc jquery detection
如何使用javascript/jQuery/etc来检测Flash是否已安装,如果不是,则显示包含告知用户需要安装Flash的信息的div?
Dre*_*wid 160
如果swfobject不够,或者您需要创建一些更定制的东西,请尝试以下方法:
var hasFlash = false;
try {
hasFlash = Boolean(new ActiveXObject('ShockwaveFlash.ShockwaveFlash'));
} catch(exception) {
hasFlash = ('undefined' != typeof navigator.mimeTypes['application/x-shockwave-flash']);
}
Run Code Online (Sandbox Code Playgroud)
它适用于7和8.
Vig*_*ran 104
如果Flash插件刚刚被禁用但已安装,@ Drewid的答案在我的Firefox 25中无效.
@vertedSpear在该答案中的评论在firefox中有效但在任何IE版本中都没有.
所以结合他们的代码并得到了这个.在Google Chrome 31,Firefox 25,IE 8-10中测试过.谢谢Drewid和invertedSpear :)
var hasFlash = false;
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (fo) {
hasFlash = true;
}
} catch (e) {
if (navigator.mimeTypes
&& navigator.mimeTypes['application/x-shockwave-flash'] != undefined
&& navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) {
hasFlash = true;
}
}
Run Code Online (Sandbox Code Playgroud)
alb*_*ein 18
您可以使用navigator.mimeTypes.
if (navigator.mimeTypes ["application/x-shockwave-flash"] == undefined)
$("#someDiv").show ();
Run Code Online (Sandbox Code Playgroud)
mhe*_*384 10
jqplugin:http://code.google.com/p/jqplugin/
$.browser.flash == true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
117590 次 |
| 最近记录: |