/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function positionError(err) { var msg; switch(err.code) { case err.UNKNOWN_ERROR: msg = "Unable to find your location"; break; case err.PERMISSION_DENINED: msg = "Permission denied in finding your location"; break; case err.POSITION_UNAVAILABLE: msg = "Your location is currently unknown"; break; case err.BREAK: msg = "Attempt to find location took too long"; break; default: msg = "Location detection not supported in browser"; } document.getElementById('info').innerHTML = msg; }