如何允许网站在 Microsoft Edge 上请求地理定位权限

How to allow a website to ask for geolocation permissions on Microsoft Edge

我正在开发一个网站,在用户登录后询问他们的位置。

我错误地删除了本地计算机上 Edge 中的本地主机权限。

现在,当我在控制台中调用 navigator.geolocation.getCurrentPosition()

我明白了:

navigator.geolocation.getCurrentPosition((p) => {console.log(p)}, (e) => {console.log(e)})
-------------------------
[object PositionError]: {code: 1, message: "This site doesn't have permission to ask for your location."}
code: 1
message: "This site doesn't have permission to ask for your location."

__proto__: Object

如何 "re-allow" 网站 "localhost" 获得在 Microsoft Edge 中询问我的位置的权限?

Link to question on Microsoft Support Community Forum

There is a request for this question to be moved to either the MSDN or the TechNet forum

重新启动计算机。为我工作...

对于 windows 10,请尝试转到“设置”(从 Windows 中的“开始”菜单搜索)>“隐私”>“位置”,然后选择可以使用您精确位置的应用。

要管理所有网站的权限,select 三点状图标 > 设置 > 高级 > 网站权限下的管理权限。更多详情请查看change website permissions - Edge.