HTML and CSS Reference
In-Depth Information
lying platform-specific implementation through a simple JavaScript API that is aligned
to the W3C Geolocation API specification. Under an MIT license,
geo-location-javascript supports a range of platforms, including iOS, Android, Black‐
Berry OS, browsers with Google Gears support (Android, Windows Mobile), Nokia Web
Run-Time (Nokia N97), webOS Application Platform (Palm Pre), Torch Mobile Iris
Browser, and Mozilla Geode.
To setup and use the API, the code you need is:
<html>
<head>
<title> Javascript geo sample </title>
<script src= "http://code.google.com/apis/gears/gears_init.js"
type= "text/javascript" charset= "utf-8" ></script>
<script
src= "js/geo.js" type= "text/javascript"
charset= "utf-8" ></script>
</head>
<body>
<b> Javascript geo sample </b>
<script>
if ( geo_position_js . init ()){
geo_position_js . getCurrentPosition ( success_callback ,
error_callback ,
{ enableHighAccuracy : true });
}
else {
alert ( "Functionality not available" );
}
function success_callback ( p )
{
alert ( 'lat=' + p . coords . latitude . toFixed ( 2 ) + ';
lon=' + p . coords . longitude . toFixed ( 2 ));
}
function error_callback ( p )
{
alert ( 'error=' + p . message );
}
</script>
</body>
</html>
Webshims lib
Supporting all jQuery's A-graded browsers and the latest Opera, the Webshims ( http://
afarkas.github.com/webshim/demos ) framework is based on jQuery and Modernizr and
falls under an MIT license. It tries to handle many different polyfills and shims, including
Gelocation.
Search WWH ::




Custom Search