如何在 JavaScript 中检测浏览器对 Flash 的支持?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7415261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 00:02:56  来源:igfitidea点击:

How can I detect browser support of Flash in JavaScript?

javascriptjquerybrowserdetect

提问by Vipul Vaghasiya

This my HTML code but if the browser does not support Flash then I want to replace the image in the Flash part

这是我的 HTML 代码,但如果浏览器不支持 Flash 那么我想替换 Flash 部分中的图像

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <script type="text/javascript">
      if (typeof navigator.plugins['Shockwave Flash'] !== 'undefined') {
        alert('support');
      } else {
        alert('not support');
      }
    </script>
  </head>

  <body>
  </body>
</html>

回答by Dan Short

I would use one of the Flash Detection JavaScript libraries out there. This oneworks well.

我会使用其中一个 Flash 检测 JavaScript 库。这个效果很好。