使用 Google 地图的混合内容

Dav*_*kro 3 https google-maps zk mixed-content

我在我的网站中使用 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>
Run Code Online (Sandbox Code Playgroud)

在我的本地服务器中工作正常,但在我的生产服务器中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
Run Code Online (Sandbox Code Playgroud)

Mah*_*tap 5

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

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"/>
Run Code Online (Sandbox Code Playgroud)

在头脑中