window默认定位

console.log("当前页面的navigator", navigator)
if
("geolocation" in navigator) { navigator.geolocation.getCurrentPosition(function(position) { console.log("纬度:", position.coords.latitude); console.log("经度:", position.coords.longitude); }, function(error) { console.error("Error Code = " + error.code + " - " + error.message); }); } else { console.error("Geolocation is not supported by this browser."); }

 

posted @ 2026-07-10 10:01  海底流  阅读(8)  评论(0)    收藏  举报