两个方法检测用户浏览器是否安装flash插件
1、新建html文档。
2、书写hmtl代码。<h1>方法一:</h1><h1>纯js检测用户浏览器是否安装flash插件</h1><h3>若已经安装flash,则返回true,反之false</h3>
3、书写css代码。<style> body{text-align: center} </style>
4、书写并添加js代码。<script>function hasFlash(){ if (navigator.plugins && navigator.plugins.length && navigator.plugins['Shockwave Flash']) { return true; } else if (navigator.mimeTypes && navigator.mimeTypes.length) { var mimeType = navigator.mimeTypes['application/x-shockwave-flash']; return mimeType && mimeType.enabledPlugin; } else { try { var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); return true; } catch (e) {} } return false;}alert(hasFlash());</script>
5、代码整体结构。
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:26
阅读量:22
阅读量:64
阅读量:52
阅读量:93