Skip to main content

HTML5 Input Fields

HTML5 was released in 2014 and is the current major version of the Hypertext Markup Language (HTML).  HTML is the language that your web-browsers  to present content on the web.  One of the important features in HTML5 is the increase in the increase in the number of input fields formally supported and the accompanying browser support for these fields. These new input types include email, tel, number, date, time, and color among other types.  The accompanied browser functionality includes custom keyboards/input options and local input validation for the input values.  Best of all the new input types are backwards compatible with browsers that do not support HTML5.  If a browser does not support a given input type the default behavior is to treat the field as a text input type.  Developers can implement the newer input types with the knowledge that unsupported browsers will fail gracefully.

The biggest benefit for end users is the increase in ease of use.  Especially on mobile platforms where customized keyboards and custom input options make for a better user experience.  Some examples include the email type adding "@" and .com to the keyboard, the number type changing the keyboard to only numbers, and the date type using a calendar to pick a date.

For developers the new input types are a double edged sword.  On a positive note browsers can now assist in validating form input.  Unfortunately the input validation cannot be trusted.  The validation on the fields is dependent on which browser is used and is in no way guaranteed to work the same between different browsers.   As mentioned before some browsers do not support the new input types and treat the input as text, which has no validation.  Browser validation is also easy to bypass using tools to manipulate the values passed to the web server.  Most importantly it is never a good idea to trust any input provided by a user or external process.   It is a security best practice to always sanitize and validate any input.  This practice helps protect against the most common attacks.

I have included several input fields below to let you see how/if your browser of choice supports the new HTML5 input types.


Input TypeExample
search
email
url
tel
number
range
date
month
week
time
datetime
datetime-local
color

Comments

Popular posts from this blog

Welcome to My InfoSec Ramblings

I would like to invite everyone to my newly founded information security blog.  I have been thinking about launching a blog for a few years and finally decided to pull the trigger.  I believe this blog will be mutually beneficial to my readers and myself.  The main goal of this blog is to serve as motivation for myself to increase my knowledge in this extremely wide field and create an obligation to write articles.  I am planning on focusing on Information Security topics, but will occasionally write about other topics. A little bit about myself and my background.  I have a strong formal education background.  I also have over a decade of experience in  Information Technology and Information Security ranging across planing and designing IT deployments, system administration, vulnerability research, penetration testing, and incident response. Please feel free to comment on this and any future post.  I would like to create a strong community aro...