2015-11-09 30 views
1

我想用的iframe「X-框架 - 選項」到「SAMEORIGIN」谷歌地圖MVC

<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頁面 但給一個錯誤,像拒絕顯示'https://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid= ... & ll =,& spn =,&輸出=嵌入& z = 6',因爲它設置了'X-Frame-Optio ns'改爲'SAMEORIGIN'。

回答

0

我有同樣的問題,並通過在我的Global.asax中將AntiForgeryConfig.SuppressXFrameOptionsHeader = true添加到protected void Application_Start()方法來解決它。

這應該解決它。