使用Google地图混合内容



我在我的网站中使用gmaps显示映射。

我的代码

<div class="col-md-12" >
  <script type="text/javascript" content="zk.googleAPIkey='***MyKey***'" />
    <gmaps id="gmaps" zoom="${initialZoom}" lat="${initialLatitude}" lng="${initialLongitude}" width="100%" height="350px" showSmallCtrl="false"   >
    <gmarker id="marker"  content="" visible="${false}" />
    </gmaps>
</div>

在我的本地服务器中工作正常,但是在我的生产服务器中, https 不起作用,我有此错误:

异常

zk.wpd:20 Mixed Content: The page at 'https://www.domain.com/' was loaded over HTTPS, but requested an insecure script 'http://www.google.com/jsapi?key=***MyKey***'. This request has been blocked; the content must be served over HTTPS.loadScript @ zk.wpd:20

添加了以下内容并解决了我的问题

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"/>

头部

i对我的问题remplace zk.googleAPIkey=****key*** for https://maps.googleapis.com/maps/api/js?key=****key***

问题是此标签zk.googleAPIkey,因为您的值是http://maps.googleapis.com/maps/api/js? http

问题

之前
<script type="text/javascript" content="zk.googleAPIkey='***MyKey***'" />

之后

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=***key***" />

来自Google地图的ZK演示:

<gmaps version="3.26" id="gmaps" width="520px" height="400px" showSmallCtrl="true" protocol="https">

您可以尝试添加协议属性吗?

最新更新