From the course: HTML5: Geolocation
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
A simple Google map with current location - HTML Tutorial
From the course: HTML5: Geolocation
A simple Google map with current location
This is a simple example of using HTML5 geolocation data with the Google Maps API. This is in the Chapter 3 folder in your exercise files, and it's 01-geoLocMap.html. And we're not actually going to be editing it, so I am not making a working copy. Let's just take a quick look at here. We will get into a lot of detail in the code in the next movie, but you can see that it uses the Google Maps API, and that's called in right here on line 26. And just before that, we have a little bit of CSS that's just for making sure that the map shows full screen, and then we've got some global variables, we have some position options, the GeoLocation function, which is the same as we've seen before for testing for the presence of the geolocation object. Show_map (position) is little bit changed because now we are using the Google Maps API to show the location, and the geo_error is the same. stopWatching and startWatching are just a little bit different because we don't have that button anymore. And…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.