{"aliases":["caniuse:geolocation","modernizr:geolocation","Navigator.prototype.geolocation"],"browsers":{"ie":"6 - 8","opera":"15","safari":"4"},"dependencies":["document.head"],"docs":"https://developer.mozilla.org/en-US/docs/Web/API/Navigator/geolocation","spec":"http://www.w3.org/TR/geolocation-API/#navi-geo","baseDir":"navigator/geolocation","hasTests":false,"rawSource":"\n// navigator.geolocation\n(function (global) {\n\tfunction Geolocation() {\n\t\tthis.getCurrentPosition = getCurrentPosition;\n\t}\n\n\tfunction Position(response) {\n\t\tvar date = new Date();\n\n\t\tthis.coords = new Coordinates(response);\n\t\tthis.timestamp = date.getTime();\n\t}\n\n\tfunction PositionError(code) {\n\t\tthis.code = code;\n\n\t\tthis.message = 'Network location provider at \\'' + url_geoip + '\\' : ' + errors[code - 1];\n\t}\n\n\tfunction PositionOptions(options) {\n\t\tthis.timeout = parseFloat(options.timeout) || timeout;\n\t}\n\n\tfunction Coordinates(response) {\n\t\tthis.latitude = response.latitude;\n\t\tthis.longitude = response.longitude;\n\t}\n\n\tfunction getCurrentPosition(success, error, options) {\n\t\tconfirmed = confirmed || confirm(request);\n\n\t\tif (!confirmed) {\n\t\t\tsetTimeout(function () {\n\t\t\t\terror.call(global, new PositionError(1));\n\t\t\t});\n\n\t\t\treturn;\n\t\t}\n\n\t\tvar\n\t\tscript = document.head.appendChild(document.createElement('script')),\n\t\tpositionOptions = new PositionOptions(options || {});\n\n\t\tgeolocation.timeout = setTimeout(function () {\n\t\t\tsetTimeout(function () {\n\t\t\t\tdocument.head.removeChild(script);\n\t\t\t});\n\n\t\t\tdelete geolocation.callback;\n\n\t\t\terror.call(global, new PositionError(3));\n\t\t}, positionOptions.timeout);\n\n\t\tgeolocation.callback = function (response) {\n\t\t\tclearTimeout(geolocation.timeout);\n\n\t\t\tsetTimeout(function () {\n\t\t\t\tdocument.head.removeChild(script);\n\t\t\t});\n\n\t\t\tdelete geolocation.callback;\n\n\t\t\tsuccess.call(global, new Position(response));\n\t\t};\n\n\t\tscript.addEventListener('error', function () {\n\t\t\tsetTimeout(function () {\n\t\t\t\tdocument.head.removeChild(script);\n\t\t\t});\n\n\t\t\tdelete geolocation.callback;\n\n\t\t\terror.call(global, new PositionError(2));\n\t\t});\n\n\t\tscript.src = url_geoip + url_geoip_callback;\n\t}\n\n\tPositionError.prototype.PERMISSION_DENIED = 1;\n\tPositionError.prototype.POSITION_UNAVAILABLE = 2;\n\tPositionError.prototype.TIMEOUT = 3;\n\n\tvar\n\turl_geoip = 'http://freegeoip.net/',\n\turl_geoip_callback = 'json/?callback=navigator.geolocation.callback',\n\terrors = ['Permission denied', 'Position undetermined', 'Timeout elapsed'],\n\ttimeout = 1000 * 60,\n\trequest = 'This page wants to track your physical location.\\nDo you allow it?',\n\tconfirmed = false,\n\t// navigator.geolocation\n\tgeolocation = navigator.geolocation = new Geolocation();\n})(this);\n","minSource":"!function(t){function e(){this.getCurrentPosition=c}function o(t){var e=new Date;this.coords=new a(t),this.timestamp=e.getTime()}function i(t){this.code=t,this.message=\"Network location provider at '\"+l+\"' : \"+r[t-1]}function n(t){this.timeout=parseFloat(t.timeout)||d}function a(t){this.latitude=t.latitude,this.longitude=t.longitude}function c(e,a,c){if(m=m||confirm(s),!m)return void setTimeout(function(){a.call(t,new i(1))});var r=document.head.appendChild(document.createElement(\"script\")),d=new n(c||{});h.timeout=setTimeout(function(){setTimeout(function(){document.head.removeChild(r)}),delete h.callback,a.call(t,new i(3))},d.timeout),h.callback=function(i){clearTimeout(h.timeout),setTimeout(function(){document.head.removeChild(r)}),delete h.callback,e.call(t,new o(i))},r.addEventListener(\"error\",function(){setTimeout(function(){document.head.removeChild(r)}),delete h.callback,a.call(t,new i(2))}),r.src=l+u}i.prototype.PERMISSION_DENIED=1,i.prototype.POSITION_UNAVAILABLE=2,i.prototype.TIMEOUT=3;var l=\"http://freegeoip.net/\",u=\"json/?callback=navigator.geolocation.callback\",r=[\"Permission denied\",\"Position undetermined\",\"Timeout elapsed\"],d=6e4,s=\"This page wants to track your physical location.\\nDo you allow it?\",m=!1,h=navigator.geolocation=new e}(this);","detectSource":"'navigator' in this && 'geolocation' in this.navigator"}