我正在使用 HTML5 地理定位功能。我的代码在“本地主机”中运行良好,但在“子域”中出现问题。我的代码如下:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition, showError);
} else {
console.log("Geolocation is not supported by this browser.");
}
Run Code Online (Sandbox Code Playgroud)