如果安装了 Flash Player,则重定向到另一个域的 Javascript 代码

标签 javascript flash

我实际上在同一个域上有两个网站。比如说

http://www.abc.com/flashsite

&

http://www.abc.com/htmlsite

flashsite包含完全基于flash的网站,而另一个是基于html的没有flash的网站。我想要的是,如果有人访问我的网址 http://www.abc.com ,javascript应该首先检测他的浏览器中是否安装了插件。如果是,那么它应该直接带我到“flashsite”文件夹,如果不是,那么它应该默认加载 html 网站。

提前致谢。

最佳答案

代码“无耻”复制自http://www.adobe.com/support/flash/how/shock/javaplugs/javaplugs05.html

<script type="text/javascript">

<!-- use this comment tag to hide the enclosed code from old browsers.

//Look for a version of Internet Explorer that supports ActiveX (i.e., one that's
//running on a platform other than Mac or Windows 3.1) or a browser that supports
//the plugin property of the navigator object and that has Flash Player 2.0
//installed.

if ((navigator.appName == "Microsoft Internet Explorer" &&
    navigator.appVersion.indexOf("Mac") == -1 &&   navigator.appVersion.indexOf("3.1") == -1) ||

    (navigator.plugins && navigator.plugins["Shockwave Flash"])
                       || navigator.plugins["Shockwave Flash 2.0"]){

   //Load a pre-defined HTML page with Flash Player in it into the browser window.
    //window.location='flashed.html';
   alert ("flash plugin detected");
}
else {
    //Load a pre-defined HTML page without Flash Player into the browser window.
    //window.location='nonflashed.html';
   alert("flash plugin not detected");
}

// Close the comment tag. -->

</script>

关于如果安装了 Flash Player,则重定向到另一个域的 Javascript 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5026471/

相关文章:

flash - AS3 掩码奇怪的结果

javascript - 如何挂载MVC Nodejs + Express

pdf - 将 SWF 文件转换为 PDF 的工具

flash - 如何在 Flash 客户端中操纵多个声音对象的位置,然后将它们混合在一起?

javascript - Flowplayer 设置来自 Amazon S3 的 .flv 视频的开始时间

javascript - JW Player 嵌入式 Flash 播放器无法正常播放

apache-flex - 弹性 : Does the flex compiler automatically optimize embedded PNG assets?

javascript - 生成字符串的所有辅音

javascript - 未定义条目的 Math.max 和 Math.min NaN

javascript - 如何将这些对象键值放入文本框中?