本文介绍了现代或不赞成使用js / jquery检测flash播放器的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,抱歉在这里重新提出这个问题。
我一直在尝试两天如何使用javascript / jQuery来达到这个工作,我想我已经阅读了所有堆栈溢出和其他博客帖子,所以请不要把它标记为重复的,因为我无法使用2012年以来的过时脚本。



我有一个页面重定向到第三方电子学习平台,其中一些内容需要flash上班。许多用户并不在乎他们的机器上安装了哪些软件(多么新,呵呵),所以我需要检测它,并显示请安装/更新Flash播放器点击这里的信息,但我找不到现代在任何地方,如果可能的话,脚本/方法来做到这一点,简化。

我试过的所有脚本都被弃用或在所有浏览器中返回false,已经安装并激活了最新版本的Flash。



Anny的帮助将被赞赏(除了现在不工作的旧帖子或脚本的链接)。 >

非常感谢!

解决方案

有一个简单的方法来检查Flash因为所有安装和启用的插件都将列在 navigator.plugins中;



请注意,如果插件已安装,但未启用,则不会在 navigator.plugins 数组中检测到该插件。有 NO 方式来检测这个使用Javascript(这

说了这样的话, ,使用以下函数 isFlashEnabled(); 来检测Flash:

  < HTML> 

< script>

if(isFlashEnabled())
{document.write('Flash is installed(but may be to be enabled)'); }
else {document.write('Flash is not installed or disabled'); }

函数isFlashEnabled()
{
var flash = navigator.plugins.namedItem('Shockwave Flash');
if(!flash){return 0; }
else {return 1; }
}

< / script>

< body> < embed src =https://www.w3schools.com/tags/helloworld.swf> < /体>

< / html>


First of all, sorry for ressurrecting this question here.I've been trying for two days how to reach this job using javascript/jquery and i think i've read all stack overflow and other blogs posts about that, so please, don't mark it as duplicated because I can't use out-dated scripts from 2012 now in 2017.

I've a single page that redirects to a third party e-learning platform where some content needs flash to work. Many users don't care about which software is installed on their machines (what a new, huh) so i need to detect it and show the tipical message "please install/update flash player clicking here", but i cannot find a "modern" script/way to do this, in any place, simplified, if possible.

All scripts i've tried are deprecated or returns false in all browsers, even i've newest version of flash installed and active.

Anny help will be appreciated (except links to older posts or scripts that don't work nowadays, obviously).

Thanks a lot!

There is a simple way to check for Flash since all the installed and enabled plugins will be listed in navigator.plugins;

Note that if a plugin is installed, but not enabled, it will not be detected in the navigator.plugins array. There is NO way to detect this using Javascript (this Question which confirms the same).

Having said that, use the following function isFlashEnabled(); to detect Flash :

<html>

<script>

if(isFlashEnabled()) 
{ document.write('Flash is installed (but may need to be enabled)'); } 
else { document.write('Flash is either not installed or disabled'); }

function isFlashEnabled() 
{
    var flash = navigator.plugins.namedItem('Shockwave Flash');
    if (!flash) { return 0; } 
    else { return 1; }
}

</script>

<body> <embed src="https://www.w3schools.com/tags/helloworld.swf"> </body>

</html>

这篇关于现代或不赞成使用js / jquery检测flash播放器的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 17:04