Subscribe / Unsubscribe Enewsletters | Login | Register

Pencil Banner

HTML5 in the Web browser: Geolocation, JavaScript, and HTML5 extras

Peter Wayner | March 23, 2011
Geolocation, Web Workers, History manipulation, iFrame sandboxes, and other HTML5 specs laying the groundwork for a safer and smarter Web

For example, WebKit browsers used to allow <script> tags that closed themselves with a final slash, />. Anyone who included an outside file with such a tag would find that the code worked in the WebKit world but not in the other browsers. There are a bazillion examples like this that have appeared and disappeared in different versions of the browsers.

The HTML5 Parsing spec includes dozens of steps that the browsers should use to determine the encoding delivered by the distant Web server. There are also a surprisingly large number of suggestions for how to do the right thing when working through the tags in a <table>. I'm thankful for this because I've pulled out my hair in the past when one browser (that will remain nameless) wouldn't work unless I inserted a proper <tbody> layer. Yech.

There are hundreds of different ways that the new rules will unify the browsers, almost all of them small but occasionally maddening. It would be difficult to list or even test them all. One of the more notable changes is in how the MathXML and SVG files can now be embedded inline like this:

In other words, MathML and SVG are now pretty much part of regular HTML, except on older browsers, all of which will have to be explicitly supported for some time.

A number of these enhancements rise above the truly minor. Some of the so-called text-level semantic enhancements are like the microformats designed for the standard data elements floating around in text. For example, the <abbr> tag will mark all TLAs (three-letter acronyms) and allow you to embed the full definitions in case anyone is curious.

HTML5 History API Who wouldn't want to rewrite history? The new HTML5 History object provides a limited number of ways to meddle with the browser's history. You can't take a broad sword and change the entries for different sites, but you can add new pages and rewrite the entries from the current site.

For instance, if you happen to click through n pages of a Top 1,000 list on a site and generate 1,000 page views for the ad sales department, you'll end up with 1,000 different entries in your history. If you want to go back to the page before the slideshow, you'll need to slog through 1,000 entries. JavaScript manipulation of the history can save you from this trouble.

 

Previous Page  1  2  3  4  5  6  Next Page 

Sign up for Computerworld eNewsletters.