Kam*_*ini 2 html javascript windows safari geolocation
致力于html5地理定位.
尝试过mozilla,chrome,IE.他们工作正常,但没有为野生动物园工作.在Mac上的safari(8.0.5)上进行测试,在windows上使用safari(5.1)进行测试
只需点击网址
http://www.w3schools.com/html/html5_geolocation.asp
Run Code Online (Sandbox Code Playgroud)
要么
http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_geolocation
<!DOCTYPE html>
<html>
<body>
<p>Click the button to get your coordinates.</p>
<button onclick="getLocation()">Try It</button>
<p id="demo"></p>
<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
它允许弹出允许/禁止但在允许后不执行任何操作.我已经在Mac上测试了与wi-fi连接的Safari,但不适用于wi-fi和LAN上的笔记本电脑.
| 归档时间: |
|
| 查看次数: |
10770 次 |
| 最近记录: |