Javascript to check if there is flash player installed and redirect to the neededn page - Stack Overflow

I have this script. This determines if there is a flash player installed in the browser, it redirects t

I have this script. This determines if there is a flash player installed in the browser, it redirects the browser to a flash website. if not, then it opens a non-flash website.

The Code is here:

 <SCRIPT LANGUAGE="JavaScript">
    <!-- 
    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"]){
    window.location='flash/index.html';
}
else {
    window.location='index.html';
}
-->
</SCRIPT>

What i want is to embed this code in the non-flash index page. it should just check if there is no flash then simply go with the current index file that already has been opened, or if there is no flash player, then load the index file from within the flash website.

Currently, when index.html (non-flash) is opened, it goes into loop and keeps on checking for the flash player. Can I modify the window.location='index.html'; statement no to load any file here, just go on with the file already opened.??

I have this script. This determines if there is a flash player installed in the browser, it redirects the browser to a flash website. if not, then it opens a non-flash website.

The Code is here:

 <SCRIPT LANGUAGE="JavaScript">
    <!-- 
    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"]){
    window.location='flash/index.html';
}
else {
    window.location='index.html';
}
-->
</SCRIPT>

What i want is to embed this code in the non-flash index page. it should just check if there is no flash then simply go with the current index file that already has been opened, or if there is no flash player, then load the index file from within the flash website.

Currently, when index.html (non-flash) is opened, it goes into loop and keeps on checking for the flash player. Can I modify the window.location='index.html'; statement no to load any file here, just go on with the file already opened.??

Share Improve this question asked Mar 10, 2011 at 7:59 themajiksthemajiks 4141 gold badge8 silver badges23 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

Just remove the else statement.

To embed Flash content, I generally suggest using SWFObject. Using the SWFObject Generator is pretty straightforward.

Using SWFObject, you can enter both alternative content and Flash content on the same page. But it requires a little bit of refactoring in your case.

Since using a JavaScript to achieve what you want just moves the problem to another location you should consider using another Method described here:

http://en.allexperts./q/Shockwave-Flash-1515/flash-flash.htm

This method is a secure way to determine if the user has flash or not no matter which browser he uses or which version or if he has enables JavaScript or not.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745147510a4613713.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信