gpt4 book ai didi

javascript - 记住智能手机当前位置的选择

转载 作者:行者123 更新时间:2023-11-30 17:59:35 24 4
gpt4 key购买 nike

我想根据智能手机的 GPS 坐标记录用户位置。

很简单,使用一个网站。我目前有这个工作,但有点烦人的是,当用户访问信息时,他们会被警报所困扰(是否可以使用你的位置)。我希望有一种方法可以让用户选择记住这个决定。尽管对这种能力没有信心。

欢迎提出任何想法或解决方案!

最佳答案

没有。你没有办法做到这一点。地理定位权限由浏览器本身处理。

来自geolocation API :

4.1 Privacy considerations for implementers of the Geolocation API

User agents must not send location information to Web sites without the express permission of the user. User agents must acquire permission through a user interface, unless they have prearranged trust relationships with users, as described below. The user interface must include the host component of the document's URI. Those permissions that are acquired through the user interface and that are preserved beyond the current browsing session (i.e. beyond the time when the browsing context is navigated to another URL) must be revocable and user agents must respect revoked permissions.

Some user agents will have prearranged trust relationships that do not require such user interfaces. For example, while a Web browser will present a user interface when a Web site performs a geolocation request, a VOIP telephone may not present any user interface when using location information to perform an E911 function.

获取权限并记住这些权限是用户代理的工作。

关于javascript - 记住智能手机当前位置的选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17356377/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com