HTML and CSS Reference
In-Depth Information
• tel (telephone)
• number
offer the most advantage to devices that use software based keyboards. In these cases the
device can present the user with a set of keys best suited to the input type. For instance, if
the type was email the keyboard may present the user with the alphabetic characters, the
“@” symbol, the “.” and maybe a special “.com” key.
Mobile devices in particular offer interesting possibilities for input types such as tel and
email , since the browser could potentially autocomplete these based on details in the mo-
bile phone's phonebook.
HTML5 validation (which will be introduced below) can also validate that these fields con-
tain valid values for their specified type.
In addition, HTML5 offers the following input types which, like the date input type, are
expected to present the user with a widget to simplify the choice of a value:
• color
• datedatetime
• datetime-local
• month
• range
• search
• time
• week
In reality most of these types cannot be relied on in most browsers. This is a familiar prob-
lem for developers of web applications, so it is worth stopping to discuss the concept of
“polyfills”, which are a common solution to this problem.
A polyfill is an elegant solution to the problem that some features are supported by a subset
of browsers. If a feature is natively supported in a particular browser, the polyfill does noth-
ing. If the feature is not supported, the polyfill provides an implementation, usually via a
JavaScript library.
In order to utilize polyfills, the following two features are required:
1. The ability to detect whether a browser supports a particular feature.
Search WWH ::

Custom Search