Several of my colleagues were discussing HTML 5, and one of them pointed me to this great online book: Dive into HTML 5. After some reading, I thought I’d try my hand at using the HTML 5 geolocation API in Visualforce.
- Create a Static Resource called modernizr, mapping to the file.
- The includeScript includes the static resource (the Modernizr library)
- The doTheGeoThang() function checks that you’re hip, and then calls findMe() with your location if you are
- findMe() is created using the actionFunction Visualforce component (see this blog post). When it’s called, it invoked the iFoundYou() method in our controller, and rerenders the outputPanel containing the longitude and latitude.