Thursday, April 30, 2009

Google Location Services now in Mozilla Firefox

With recent launches like Google Latitude and Google Toolbar with My Location, it's clear we think location-based services are useful and fun! We also want developers everywhere to be able to use location to build cool new features and applications.

I'm pleased to announce that Google's Location Service (the same service which powers the My Location feature in many Google products), is now the default location provider in Mozilla Firefox 3.5 beta 4. This means that developers can, with users' permission, gain access to their approximate location without requiring any additional plug-ins or setting configurations. It just works!

Mozilla Firefox 3.5 beta 4 uses the W3C geolocation API, a standard being adopted by many major browsers, so you won't have to branch code in the future.

For web developers, using geolocation services in Firefox is easy! Here's a simple example to get you started:
<html>
<head>
<script type="text/javascript">

function displayLocation(loc) {
var locDiv = document.getElementById("locationDiv");
locDiv.innerHTML = "lat: " + loc.coords.latitude + ", lon:" + loc.coords.longitude;
}

function getLocation() {
navigator.geolocation.getCurrentPosition(displayLocation);
}

</script>
</head>

<body>
<a href="#" onClick="getLocation()">Click here to display location</a><br>
<div id="locationDiv"></div>
</body>
</html>
When your site calls getCurrentPosition, a drop down will ask the user permission to get his or her location. Upon acceptance of the request, the callback function you specify will run with the machine's approximate location contained in the loc parameter. Here's a screenshot of the permission dropdown:


We hope you find the new and useful ways to use the new geolocation capabilities of Firefox!

3 comments:

  1. US Patent No. 2,525,425, entitled “system and method for defining an event based on relationship between an object location and a user-defined zone” recently issued with broad claims covering location cased application where users are allowed access to each other location information relative to user defined zones, see claims 1 and 27 of the patent. It seems to cover Google Latitude.

    ReplyDelete
  2. US Patent No. 7,525,425, entitled “system and method for defining an event based on relationship between an object location and a user-defined zone” issued a few days ago with broad claims covering location cased application where users are allowed access to each other location information relative to user defined zones, see claims 1 and 27 of the patent. It seems to cover Google Latitude.

    ReplyDelete
  3. how can web master get benefit in terms of getting location of website viewers?
    Is it usefull for ecommerce website?

    reply me

    ReplyDelete