使用 $.support 或 $.browser 测试多个浏览器

发布于 2024-08-06 13:16:58 字数 133 浏览 9 评论 0原文

确定用户是否使用 IE 7 或 8、Firefox、Safari、Chrome 或 Opera 的最佳方法是什么?

如果他们不使用这些浏览器,我想显示一条消息。在这种情况下,使用浏览器嗅探是否更容易?

What's the best way to find out if a user is not using IE 7 or 8, Firefox, Safari, Chrome or Opera?

I want to show a message if they are not using one those browsers. In this case is it just easier to use browser sniffing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

回梦 2024-08-13 13:16:58

问题是,将来当新的浏览器发布并且变得比列出的浏览器更现代时,您的消息将会显示,我假设说的是“如果您不使用 X,您就无法利用所有浏览器”这个应用程序的好处'在这种情况下,我建议您不要因为这个原因而这样做。

您不会总是在支持该应用程序,并且可能不会考虑其他完全现代且有效的用户代理,这些用户代理使用这些引擎之一(例如 Webkit)但不将自己标识为此类。

The problem is, in the future when a new browser is released and becomes more modern than those listed, your message will show up, I assume saying something to the effect of 'If you're not using X, you can't utilize all the benefits of this application' in which case I would advise you to not do this for that exact reason.

You won't always be around to support the application, and possibly won't account for other perfectly modern and valid user agents that use one of those engines such as Webkit but do not identify themselves as such.

酒废 2024-08-13 13:16:58

你这样做的原因是什么?如果它是告诉使用旧浏览器的用户他们需要升级,那么请选择您的网站需要平稳运行的一些功能,对其进行测试,如果测试失败,则显示该消息。这样,您就不会被锁定到对兼容浏览器列表进行硬编码,并且当新版本/替代浏览器出现时,它们不会被归入“不良浏览器”池中。

What is your reason for doing this? If its to tell users with older browsers that they need to upgrade, then pick some features that your site needs in order to run smoothly, test for them, and if the tests fail, display the message. This way you aren't locked into hard coding a list of compliant browsers and when new versions/alternate browsers come out, they won't be lumped in the "bad browser" pool.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文