// Try W3C Geolocation (Preferred)
if(navigator.geolocation) {
browserSupportFlag = true;
navigator.geolocation.getCurrentPosition(function(position) {
initialLocation = new
google.maps.LatLng(position.coords.latitude,position.coords.longitude);
map.setCenter(initialLocation);
}, function() {
handleNoGeolocation(browserSupportFlag);
});
// Try Google Gears Geolocation
} else if (google.gears) {
browserSupportFlag = true;
var geo = google.gears.factory.create('beta.geolocation');
geo.getCurrentPosition(function(position) {
initialLocation = new
google.maps.LatLng(position.latitude,position.longitude);
map.setCenter(initialLocation);
}, function() {
handleNoGeoLocation(browserSupportFlag);
});
// Browser doesn't support Geolocation
} else {
browserSupportFlag = false;
handleNoGeolocation(browserSupportFlag);
}
Why this geolocate sample code telling W3C is preferred?
Which is the most suitable to support mobile devices and also used for
desktop browser in the same time?
On Apr 28, 2:19 am, Pil <[email protected]> wrote:
> Different mobile vendors are doeing their own thing - like Google's
> Chrome doesn't support the standardized Geolocation API yet but still
> uses Gears instead.
>
> The following library tries to combine geolocation support for the
> most different mobile platforms plus desktop browsers - as far as I
> know
>
> http://code.google.com/p/geo-location-javascript/
>
> On Apr 28, 9:34 am, summerap <[email protected]> wrote:
>
>
>
> > And I found that the geolocate sample code below provided by Google
> > also cannot work in mobile devices.
>
> >http://code.google.com/apis/maps/documentation/javascript/examples/ma...
>
> > On Apr 28, 12:30 am, summerap <[email protected]> wrote:
>
> > > Regard the subject, I tried on the mini opera, android browser,
> > > symbian browser, and Iphone browser.
> > > Only the Iphone can support my geolocate google maps API v3. Can
> > > somebody tell me why other cannot support it?
> > > Thank you.
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.