简体   繁体   English

使用新的HTML5验证/必需的输入功能是一件坏事吗?

[英]Using new HTML5 validation/required input features a bad thing?

I've been getting into using some of the new HTML5 tags recently. 最近,我一直在使用一些新的HTML5标签。 One thing I realized is that, of course, a lot of these new tags only work on the most modern browsers. 我意识到的一件事是,当然,这些新标签中有很多只能在最现代的浏览器上使用。 Wouldn't that be very bad if you decide to use input attributes such as required and pattern to validate input? 如果您决定使用诸如required和pattern之类的输入属性来验证输入,那不是很糟糕吗? Your entire system could be circumvented by someone just using an older version of a browser. 仅仅使用旧版浏览器的人可能会绕过您的整个系统。

And if the answer is to have fallback validation techniques in case the user's browser is detected as being 'not modern' -- why bother using the HTML5 techniques, why not just use the fallback in the first place? 并且如果答案是要使用后备验证技术,以防用户的浏览器被检测为“不是现代的”,那么为什么还要使用HTML5技术,为什么不首先使用后备呢?

Should a page just say "this form is not compatible with your browser, please upgrade"? 页面是否应该显示“此表单与您的浏览器不兼容,请升级”? Or am I missing something? 还是我错过了什么?

For one thing if your security is client side only (javascript, html5 stuff etc) then you have no security. 一方面,如果您的安全性仅是客户端(javascript,html5等),那么您就没有安全性。 Might as well not pretend you do. 最好不要假装自己这么做。 Client side checks are just for quick feedback to the user that something might be wrong, you always check on the server side again to make sure the input is right. 客户端检查只是为了快速反馈给用户某些问题,您总是在服务器端再次检查以确保输入正确。

As to your other point, even if your page looks good with smooth html5 controls and css3, it doesn't mean that it can't still work with older rendering engines. 至于你的其他问题,即使你的页面看起来良好,平稳控制的HTML5和CSS3,但这并不意味着它不能仍然与旧的渲染引擎工作 A text box is a text box, and a button is a button. 文本框是文本框,按钮是按钮。 Only thing that's different is how fancy you get with it. 唯一不同的是您对它的幻想。 The idea is to get as many customers as you can, not turn them away because they're browsing on something you don't like. 这个想法是要吸引尽可能多的客户,而不是因为他们浏览的是您不喜欢的东西而拒绝他们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM