是否有一个轻量级库可以用来要求用户下载现代浏览器?
我正在构建一个严重依赖多个 HTML5 功能的网站。我不想为 IE6-8 开发单独的网站版本。相反,当这些用户访问时,我希望弹出一个漂亮的模式,礼貌地建议他们使用 Chrome 或 Firefox 等现代浏览器访问该网站。是否有现有的图书馆可以为我做这件事?
理想情况下,现代浏览器只需要下载浏览器检测代码即可;仅在需要时才会异步加载为模式提供支持的代码。
I'm building a site that relies heavily on several HTML5 features. I do not want to develop a separate version of the site for IE6-8. Instead, when those users visit, I'd like a nice-looking modal to pop up to politely suggest that they visit the site with a modern browser like Chrome or Firefox. Is there an existing library that will do this for me?
Ideally, modern browsers would only have to download the browser detection code; the code powering the modal would be loaded asynchronously only when needed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
试试这个:http://www.ie6countdown.com/join-us.aspx
Try this: http://www.ie6countdown.com/join-us.aspx
使用Modernizr。您无需检查他们使用的浏览器,而是可以检查您需要的确切功能,并在当前浏览器不支持时显示警报。此外,Modernizr 还包括 YepNope 库,它可以让您有条件地加载所需的资源(如您提到的模式)
Use Modernizr. Instead of checking what browser they use, you can check for the exact feature that you need and display an alert if the current browser does not support it. Additionally, Modernizr also includes the YepNope library which lets you conditionally load resources that you need (like the modal you mentioned)
同时研究 Chrome 内嵌框架。
Investigate Chrome Frame as well.
该规则是检测浏览器的功能,而不是单个浏览器。正如普拉迪克提到的,modernizr 在这方面做得非常出色。
The rule is to detect browser capabilities, not individual browsers. As pradeek mentioned, modernizr does an excellent job of this.
看起来这可以解决问题: https://github.com/viamarte/modernweb
It looks like this will do the trick: https://github.com/viamarte/modernweb