Chrome测试获取地理坐标被禁止,控制台提示以下信息
[Deprecation] getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
在测试环境下只需要修改Chrome浏览器的安全策略就可以,http://www.domian.com 换成自己的域名
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --unsafely-treat-insecure-origin-as-secure="http://www.domian.com" flag --user-data-dir=C:\testprofile