【问题标题】:Geolocation API in IE11IE11 中的地理定位 API
【发布时间】:2022-02-01 19:57:54
【问题描述】:

我尝试在 IE11 上使用 HTML5 Geolocation,但尽管允许位置权限,但我收到错误消息“此站点无权使用 Geolocation API。”

复制:

  1. 在 IE11 中打开任何网站(我是用户 browerstack 来模拟 Windows 10)
  2. 在控制台中复制/粘贴以下代码:
var options = {
  enableHighAccuracy: false,
  timeout: 1000000,
  maximumAge: 0
};

function success(pos) {
  var crd = pos.coords;

  console.log('got your position');
}

function error(err) {
  console.log(err);
}

navigator.geolocation.getCurrentPosition(success, error, options);
  1. 出现位置提示时单击“允许一次”
  2. 观察Resulting Error Message"This site does not have permission to use the Geolocation API."

我的浏览器堆栈在 Windows 10 上运行 IE11 版本 11.1.17134.0。

提前感谢您的帮助!

【问题讨论】:

  • 我可以在 IE 11 中重现该问题。我认为这是因为 IE 不支持Secure context required。地理位置仅在安全环境中可用。此外,IE 11 即将退役,我建议您可以使用现代浏览器来代替。

标签: geolocation internet-explorer-11


【解决方案1】:

我刚刚在 BrowserStack 上尝试了 -https://maps.google.com - 在 Win 10 IE 11 组合上遇到了类似的消息。

似乎在 BrowserStack 上可用的 IE 浏览器上启用了一些限制。

BrowserStack 支持 (support@browserstack.com) 团队应该能够提供帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-04
    • 2010-09-18
    • 2017-12-02
    • 1970-01-01
    • 2012-05-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多