UNPKG

modernizr

Version:

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

35 lines (33 loc) 1.06 kB
/*! { "name": "Geolocation API", "property": "geolocation", "caniuse": "geolocation", "tags": ["media"], "notes": [{ "name": "MDN documentation", "href": "https://developer.mozilla.org/en-US/docs/WebAPI/Using_geolocation" }], "polyfills": [ "joshuabell-polyfill", "webshims", "geo-location-javascript", "geolocation-api-polyfill" ] } !*/ /* DOC Detects support for the Geolocation API for users to provide their location to web applications. */ define(['Modernizr'], function(Modernizr) { // geolocation is often considered a trivial feature detect... // Turns out, it's quite tricky to get right: // // Using !!navigator.geolocation does two things we don't want. It: // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513 // 2. Disables page caching in WebKit: webk.it/43956 // // Meanwhile, in Firefox < 8, an about:config setting could expose // a false positive that would throw an exception: bugzil.la/688158 Modernizr.addTest('geolocation', 'geolocation' in navigator); });