How does HTML5 input type email works without top level domain name

The input type = email tag in html5 works even if the top level domain name is not present

<form action = "yourPage" method = "get">
    <input type =  'email' name ="emailName" >
    <input type = 'submit'>
</form>

for eg: if we type

foo@bar

instead of

foo@bar.com

The form will be submitted. Can anyone explain why it behaves like this.


Because bar is a valid hostname, which makes foo@bar a valid email address.

Chrome is not going to check for you whether the address or host are actually in use, only whether the semantics are correct.

See http://en.wikipedia.org/wiki/Email_address#Domain_part for examples of valid email addresses.

链接地址: http://www.djcxy.com/p/92922.html

上一篇: HTML5电子邮件输入模式属性

下一篇: HTML5输入类型电子邮件如何在没有顶级域名的情况下运行