Detect HTML5 Geolocation Support

March 30, 2013

Geolocation is the art of figuring out where you are in the world and (optionally) sharing that information with people you trust.
To check if the user browser support Geolocation you can use any of the following techniques:

Technique #1:

By using a JavaScript junction.
[code lang=”js”]
function supports_geolocation() {
return !!navigator.geolocation;
}
[/code]
Technique #2:

you can use Modernizr to detect support for the geolocation API.

[code lang=”js”]
if (Modernizr.geolocation) {
// let’s find out where you are!
} else {
// no native geolocation support available
// maybe try Gears or another third-party solution
}
[/code]
Get this tips from http://fortuito.us/diveintohtml5/detect.html#geolocation

Let Us Work Together

Let us Plan Your Website or Digital Strategy Together

Start My Proposal Now →