qutebrowser/tests/end2end/data/prompt/geolocation.html

39 lines
1.3 KiB
HTML
Raw Normal View History

2016-01-14 07:01:58 +01:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
function on_success(position) {
console.log("geolocation permission granted");
}
function on_error(error) {
switch(error.code) {
case error.PERMISSION_DENIED:
console.log("geolocation permission denied");
break;
case error.POSITION_UNAVAILABLE:
console.log("geolocation position unavailable (ignored)");
break;
2016-01-14 07:01:58 +01:00
default:
console.log("[FAIL] geolocation error " + error.code +
": " + error.message);
2016-01-14 07:01:58 +01:00
break;
}
}
function get_location() {
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(on_success, on_error);
} else {
console.log("[SKIP] geolocation unavailable");
2016-01-14 07:01:58 +01:00
}
}
</script>
</head>
<body>
<input type="button" onclick="get_location()" value="Get position" id="button">
2016-01-14 07:01:58 +01:00
</body>
</html>