可靠的浏览器检测的JavaScript? [英] Reliable browser detection with javascript?
问题描述
我有一个网站,并offcourse最喜欢的网站在Firefox加载速度更快。
I have a website, and offcourse like most websites it loads faster in Firefox.
我想创建某种形式的酒吧,它显示在我的网站之上,只要不FF用户进入该网站。
这间酒吧会说类似获得更好的性能等等等等安装FF ......
I want to create some form of a bar, which displays on top of my site, whenever a user without FF enters the site. This bar will say something like "Install FF for better performance etc etc..."
我应该怎么做呢?浏览器检测我猜想,但也有不同的吨codeS在那里。任何code,你都知道,更可靠,更好地使用?
How should I do this? Browser detection I guess, but there are tons of different codes out there. Any code you all know that is more reliable, and better to use?
顺便说一句,没有任何人知道,如果我需要从Mozilla的许可,能有这样的酒吧在我的网站?
Btw, does anybody know if I need permission from Mozilla to have such a bar on my website?
感谢
编辑:FF不是最快的浏览器中,我得到了它
FF IS NOT THE FASTEST BROWSER, I GOT IT!
推荐答案
的(跳过你想做的事是好还是坏事所有的参数,假设你真的喜欢Firefox和要推广它。)的
-
使用
导航
对象以检查浏览器是火狐。navigator.app codeNAME
,navigator.appName
,navigator.appVersion
。你想要做的是不是你的网站的重要组成部分,所以你并不需要一个故障安全检测方法。如果它的工作原理为您的目标用户比方法很不错的95%以上。
Use the
navigator
object to check if the browser is Firefox.navigator.appCodeName
,navigator.appName
,navigator.appVersion
. What you want to do is not a critical part of your website, so you don't need a fail-safe detection method. If it works for over 95% of your targeted users than the method is good.
我怀疑你需要许可才能公布一个免费的产品。 Mozilla的甚至鼓励你这样做。
I doubt you need permission to advertise a free product. Mozilla even encourages you to do so.
这篇关于可靠的浏览器检测的JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!