Live data from Hacker News

Have a website? Fix these 2 mistakes right now

blog.mikekhristo.com

1–3 of 3 posts

Re: Have a website? Fix these 2 mistakes right now

#2
Unfortunately, I don't think it's as simple as "just use the 'url' and 'email' input types for their respective fields."

Using the "url" input type can be a problem, due to strict validation - the validator requires a URI as specified by RFC 3986, meaning that if the user enters "example.com" rather than "http://example.com", the browser considers this invalid, blocks the form submission, and displays an error like "Please enter a URL".

This effectively breaks the form for most users, on mobile or not, so you'd need to disable HTML5 input validation on this form or field.

Re: Have a website? Fix these 2 mistakes right now

#3

Unfortunately, I don't think it's as simple as "just use the 'url' and 'email' input types for their respective fields." Using the "url" input type can be a problem, due to strict validation - the validator requires a URI as specified by RFC 3986, meaning that if the user enters "example.com" rather than " http://example.com" , the browser considers this invalid, blocks the form submission, and displays an error like…

Good point, however, I'm not sure I can recall a time during which someone intended to collect a URL from me but allowed just "example.com" as a valid input. I'd venture to guess that the validation enforced more often than not actually helps the site owner achieve their intended goal.