【问题标题】:'X-Frame-Options' to 'SAMEORIGIN' google maps MVC'X-Frame-Options' 到 'SAMEORIGIN' 谷歌地图 MVC
【发布时间】:2016-02-10 04:15:18
【问题描述】:

我想使用 iframe 显示带有以下代码的 Google 地图

<script type="text/javascript" src="https://www.googleadservices.com/pagead/conversion.js">
<noscript>
    <div style="display: inline;">
      <img height="1" width="1" style="border-style: none;" alt="" src="https://www.googleadservices.com/pagead/conversion/''/?label='';guid=ON&amp;script=0" />
    </div>
</noscript>
    <div class="mapContainer" style="width: 251px; height: 202px;">
       <iframe id="iGmap" width="251" height="202" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="@Html.Raw(Model.CurrentBranch.GoogleMapURLWithZoomSet)">
       </iframe>
    </div>

在哪里

src='http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=''&amp;ll='',''&amp;spn='',''&amp;output=embed&amp;z=4'

我在cshtml页面中使用的上述代码 但是给出像 Refused to display 'https://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=...&ll=,&spn=,&output=embed&z=6' 这样的错误,因为它将'X-Frame-Options'设置为'SAMEORIGIN'。

【问题讨论】:

    标签: asp.net asp.net-mvc asp.net-mvc-3 google-maps


    【解决方案1】:

    我遇到了同样的问题,并通过在我的 Global.asax 中将此 AntiForgeryConfig.SuppressXFrameOptionsHeader = true 添加到 protected void Application_Start() 方法来解决它。

    这应该可以解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-09
      • 1970-01-01
      • 2013-08-10
      • 1970-01-01
      • 1970-01-01
      • 2021-05-09
      • 2018-05-27
      • 2016-07-12
      相关资源
      最近更新 更多