简体   繁体   English

HTML5是否可以在旧浏览器中使用?

[英]Does HTML5 Works in Old Browsers?

I want to know that does HTML 5 validations works in old browsers if yes then its great and if not then why HTML validations are developed its a high security risk because if a beginner rely on these validations then it may be harmful for his/her. 我想知道HTML 5验证是否可以在旧的浏览器中工作,如果可以,那么它很好,如果不能,那么为什么开发HTML验证会带来很高的安全风险,因为如果初学者依赖这些验证,那么对他/她可能有害。 I added more tags because I want to know the reason behind development of HTML 5 Validations Thank you 我添加了更多标签,因为我想知道开发HTML 5验证背后的原因谢谢

I want to know that does HTML 5 validations works in old browsers 我想知道HTML 5验证在旧的浏览器中是否有效

No. New features don't work in old browsers. 不可以。新功能在旧浏览器中不起作用。

if yes then its great and if not then why HTML validations are developed its a high security risk because if a beginner rely on these validations then it may be harmful for his/her. 如果是,那么它很好,如果不是,那么为什么要开发HTML验证就具有很高的安全风险,因为如果初学者依赖这些验证,那么对他/她可能有害。

It is no more of a security risk than client side JavaScript validation. 与客户端JavaScript验证相比,它没有更多的安全风险。

Any form of client side validation is there as a convenience for the user, not for security. 客户端验证的任何形式都可以为用户带来便利,而不是安全性。

If you want security then you must use server side validation. 如果需要安全性,则必须使用服务器端验证。 You can't perform this until the form has been submitted (and then you need to send an error page back to the browser). 在提交表单之前,您无法执行此操作(然后您需要将错误页面发送回浏览器)。

I want to know the reason behind development of HTML 5 Validations 我想知道开发HTML 5验证背后的原因

People have used client side validation for years (because making things more convenient for users is a good thing). 人们使用客户端验证已经有很多年了(因为使事情对用户更方便是一件好事)。 Having a method to do it baked in to HTML makes it easier to do and gives a consistent UI. 拥有将其嵌入HTML的方法,可以更轻松地完成操作并提供一致的UI。

A relative easy way to check HTML5 support in browsers via Jquery as 通过Jquery在浏览器中检查HTML5支持的相对简单的方法为

 function supportsFormaction() {
    var input = document.createElement("input"); // create an element in memory
    return "formAction" in input; // check if the browser supports the attribute
}

Now the return of this function would be boolean as 现在,此函数的返回将是布尔值,如

  • True: Supported 正确:受支持
  • False Not Supported 错误不支持

Logic : FormAction is a HTML5 property and thus will give false when used in browsers not supporting HTML5. 逻辑FormActionHTML5属性, 因此在不支持HTML5的浏览器中使用时,将给出false。

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

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