问题描述
为什么这样的电子邮件地址: info @ example
(不带.TLD)在< input type =" email">
中验证为正确的电子邮件地址?
why does an e-mail address like: info@example
(without a .TLD) validate in <input type="email">
as a correct e-mail address?
我尝试过:
-
info @
=无效的电子邮件,符合预期 -
info @ example
=有效,与预期不符 -
[email protected]
=有效,如预期
info@
= invalid e-mail, as expectedinfo@example
= valid, NOT as expected[email protected]
= valid, as expected
当然,我可以使用正则表达式或其他方法来验证表单输入,但问题仍然存在.
Ofcourse, I can validate form input using regular expressions or other methods, but the question remains.
推荐答案
HTML5支持不带域扩展名的电子邮件地址,因为它对邮件服务器中的本地电子邮件地址完全有效.因此,为了支持每个用例,HTML5都支持它.但是,ICANN强烈建议不要使用无点电子邮件地址,因此,您不应该仅依靠HTML5电子邮件验证,而应使用另一种正则表达式验证.
HTML5 supports email addresses without domain extension because it is perfectly valid for local email addresses in mail server. So, to support every usecases, HTML5 does support it.But, ICANN highly discourages dotless email addresses therefore you shouldn't solely rely on HTML5 email validation rather compliment it with another regex validation.
这篇关于为什么info @ example根据HTML5< input type ="email">有效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!