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

FRAMINGHAM, 23 MARCH 2011 - One of the sly games that smart managers play is attaching their current project to a big, high-profile tar ball rolling down the hill, full of momentum. Now that HTML5 has become white hot after languishing for 10 years of relative disinterest, many ideas that began as cool enhancements for the Web are latching on to the bandwagon. They may be relatively independent projects, but because they involve JavaScript and HTML, they're now part of the HTML5 juggernaut.

Consider the new JavaScript functions that let your Web page determine latitude and longitude if the code is running on a device that knows where it is. These are small enhancements that would have happened whether or not HTML5 became a buzzword that managers everywhere now feel compelled to add to their deck of slides. Yet now they're often considered in the same checklist full of HTML5 features.

As we put together this series of articles about HTML5, a number of little ideas and features ended up with no place to go. They didn't naturally fit with the other articles that focused on areas such as HTML5 forms, data communications, local data storage, or the games people play with the HTML5 Canvas, video, and graphics specs. Some of these tidbits are officially part of the HTML5 standard and some are just fellow travelers, but they're all appearing in your browser soon. We had no better place to put them, so they're here.

"HTML5" geolocation The HTML5 spec doesn't officially offer the JavaScript layer the ability to find the device's location on earth, but HTML5 and geolocation have been gathering momentum at the same time, so people tend to lump them together. The geolocation tags are technically in a separate API, if you're curious.

The features are pretty basic and originally intended for smartphones and PDAs, but they're also implemented in many desktop browsers, including Chrome 5.0 and later, Firefox 3.5 and later, and Internet Explorer 9. But just because the JavaScript object navigator.geolocation is offered doesn't mean the answer returned will be available or correct. The API thankfully allows for users to cloak their location, and many implementations ask the user for permission before revealing the geolocation object to the JavaScript code. The API returns an error of the type PERMISSION_DENIED to make it clear that the user didn't want to cooperate.

 

1  2  3  4  5  6  Next Page 

Sign up for Computerworld eNewsletters.