gpt4 book ai didi

javascript - Uncaught ReferenceError : handleLocationError is not defined google maps api

转载 作者:可可西里 更新时间:2023-11-01 17:33:59 27 4
gpt4 key购买 nike

我有这个问题

getCurrentPosition() and watchPosition() are deprecated on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS.

因此我抛出这个错误

Uncaught ReferenceError: handleLocationError is not defined

所以我调用了api

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=ADVJFGFNFV4B2wTtyywqsMs--NTpg2w0&libraries=drawing,places"></script>

生产给我错误

enter image description here

本地工作完美

enter image description here

一种解决方案是使用 https。但还有另一种选择吗?

最佳答案

Chrome 已经在 50 版本中弃用了它。没有计划在 HTTP 中允许它。

localhost is treated as a secure origin over HTTP, so if you're able to run your server from localhost, you should be able to test the feature on that server.

这就是它在本地工作的原因。现在,您唯一的方法是使用 HTTPS,也许您可​​以使用像 https://letsencrypt.org/ 这样的服务(它是免费的、自动化的和开放的。)

祝你好运。

关于javascript - Uncaught ReferenceError : handleLocationError is not defined google maps api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37196230/

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