2016-12-13 106 views
0

我使用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不起作用生产服务器,我有这样的错误:

EXCEPTION

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 
+0

您是否试过用'//'设置Google脚本? – karritos

回答

2

我solvel我的问题remplace zk.googleAPIkey=****key***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***" /> 
0

ZK demo of google maps

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

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

+0

你能提供反馈吗? – chillworld

+0

但在我的情况下不起作用 –