javascript - 检测无法显示 HTML5 的浏览器

标签 javascript jquery browser browser-detection

我创建了一个包含实验性 HTML5 内容的网站。所以旧的浏览器无法显示它。

现在我想检测访问者使用的是否是旧浏览器,并将其重定向到名为“/old”的子文件夹,在该子文件夹中我将我的网站显示为非 HTML5 网站,并显示用户正在使用的提示一个旧的浏览器。

如果用户使用的是旧浏览器,我如何重定向用户?

最佳答案

使用Modernizr

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

为什么使用 Modernizr?

Taking advantage of cool new web technologies is great fun, until you have to support browsers that lag behind. Modernizr makes it easy for you to write conditional JavaScript and CSS to handle each situation, whether a browser supports a feature or not. It’s perfect for doing progressive enhancement easily.

关于javascript - 检测无法显示 HTML5 的浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22681650/

相关文章:

javascript - polymer 自定义元素不服从父 html 元素

javascript - 在 Phaser.IO 中沿着预定义的路径移动 Sprite

javascript - 如何将选择值传递给 Angularjs 模态表单

jquery - 单击标签不会选中关联的复选框

javascript - 如果我包含 .min 有关系吗?在脚本的文件名中?

javascript - 每秒更改背景图像 jQuery javascript

javascript - 获取 sql 结果作为嵌套 json 对象

jquery - 从td中查找父表标签

button - 检测主干js中的浏览器后退按钮

php - 在centos minimal中访问浏览器