Chapter 15: Embedding Objects and Storing Information

For years, users have been able to do some pretty remarkable things on the Web thanks to different kinds of plug-ins loaded inside the browser. Generally speaking, two key plug-ins are installed with most browsers: Adobe Flash Player and Java.

Some of the new HTML5 features work best in concert with either special plug-ins directly related to the new feature or through a URL that serves the new feature. HTML5 has a number of such objects, and one of the most interesting is the geolocation object. So, it’ll be the first to examine before looking at how Java and Flash work with HTML5.


The geolocation object is part of the navigation object in the HTML5 DOM. It’s a means of finding your location, more or less. In several tests, it successfully located the ballpark of my location. The most important attributes of the geolocation object are the latitude and longitude attributes. That’s because, with those values, you can load a map of your general location.

Creating an HTML page that shows users their latitude and longitude is fine, but HTML5 browsers are also able to load a map into their Web sites using Google Maps. The URL for this capability is:

“ “ + latitude + “, “ + longitude + “&spn=0.054166,0.110378&z=13&output=embed”

The latitude and longitude variables contain coordinate values. So, the trick is to locate the latitude and longitude values to insert where they’re ...

Get Smashing Html5 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.