html5地理定位不适用于Safari浏览器

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上的笔记本电脑.

Par*_*n0a 5

您是使用Wi-Fi连接还是通过有线网络连接?

当你没有与Wi-Fi连接时,似乎safari有麻烦.

资源

地理定位在Windows 7/XP上的Safari 5.x上无效

Safari 5中的地理位置