Okay, so I already looked this up and only found one page on it.
(Google Maps API GeoLocation not working for mobile)
My issue is that that I have some javas
You made a few mistakes. I updated your code and added comments for an explanation: http://jsfiddle.net/cj5xF/1/
There's also a fullscreen view (test on mobile): http://jsfiddle.net/cj5xF/1/embedded/result/
Snippet from the fixed code:
// When the page has loaded, call the getLocation function.
// Be sure not to use parenthesis after getLocation, or you will
// call it, instead of passing a reference to it to be called later (callback)
google.maps.event.addDomListener(window, 'load', getLocation);
This will call the getLocation
function when the page has loaded. The getLocation
function will perform its geolocation checks, and if available, call initialize
and pass into it the position
object, which contains coordinates. initialize
will then use those coords to create a google map.