如果支持HTML5输入,如何检查? [英] How to check, if a HTML5 input is supported?
本文介绍了如果支持HTML5输入,如何检查?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果访问者浏览器支持HTML5输入类型,我想在我的网站上查看。我应该怎么做?
I want to check in my website, if the visitors browser support a HTML5 input type. How should I do it?
推荐答案
使用表单字段可以使用:
With the form fields you can use this:
var i = document.createElement("input");
i.setAttribute("type", "color");
return i.type !== "text";
如果支持颜色,i.type将为彩色,但如果不支持,则导航器返回文本默认情况下。
所以这样一个简单的验证可以帮到你。
If color is supported, i.type will be color but if it's not supported, the navigator returns text as default. So a simple verification like this can help you.
这篇关于如果支持HTML5输入,如何检查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文