Web Addresses

Web addresses—known to many as URLs, and to a few pedants as URIs—are another type of specialized text. The syntax of a web address is constrained by the relevant Internet standards. If someone asks you to enter a web address into a form, he’ll be expecting something like http://www.google.com, not “125 Farwood Road.” Forward slashes and periods are common, but spaces are forbidden. And every web address has a domain suffix like “.com” or “.org”.

Behold...(drum roll please)...<input type="url">. On the iPhone, it looks like Figure 9-4.

Keyboard optimized for entering an email address

Figure 9-3. Keyboard optimized for entering an email address

Keyboard optimized for entering a URL

Figure 9-4. Keyboard optimized for entering a URL

Just as it does for email address fields, the iPhone provides a special virtual keyboard that’s optimized for web addresses. The space bar has been completely replaced with three virtual keys: a period, a forward slash, and a “.com” button. You can long-press the “.com” button to choose other common suffixes, like “.org” or “.net”.

Browsers that don’t support HTML5 will treat type="url" exactly like type="text", so there’s no downside to using it for all your web address–inputting needs.

Get HTML5: Up and Running now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.