Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Iframe中显示google地图_Javascript_Asp.net_Asp.net Mvc_Google Maps_Iframe - Fatal编程技术网

Javascript 如何在Iframe中显示google地图

Javascript 如何在Iframe中显示google地图,javascript,asp.net,asp.net-mvc,google-maps,iframe,Javascript,Asp.net,Asp.net Mvc,Google Maps,Iframe,我想在Razor MVC页面中显示google地图,但它没有显示,并出现如下错误: <div id="map" style="width: 251px; height: 202px;"> <iframe id="iGmap" width="251" height="202" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src=" http://maps.google.com/maps/ms?

我想在Razor MVC页面中显示google地图,但它没有显示,并出现如下错误:

<div id="map" style="width: 251px; height: 202px;">
  <iframe id="iGmap" width="251" height="202" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="
http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=XXXXXXXXXXXXXXXXXXXXX&amp;ll=XXXXXXXXXXXXXXXX&amp;spn=XXXXXXXXXXXXX&amp;output=embed">
  </iframe>
</div>
拒绝在帧中显示“”,因为它将“X-frame-Options”设置为“SAMEORIGIN”

代码如下:

<div id="map" style="width: 251px; height: 202px;">
  <iframe id="iGmap" width="251" height="202" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="
http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=XXXXXXXXXXXXXXXXXXXXX&amp;ll=XXXXXXXXXXXXXXXX&amp;spn=XXXXXXXXXXXXX&amp;output=embed">
  </iframe>
</div>


谷歌地图阻止外部网站将其嵌入iframe。这是他们的政策,所以你不能回避。如果要在iframe中显示地图,则需要通过(或其其他API之一)来实现。

谷歌地图阻止外部站点将地图嵌入iframe。这是他们的政策,所以你不能回避。如果要在iframe中显示地图,则需要通过(或其他API之一)来实现。

我通过从URL中删除“ms”实现了这一点

http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=XXXXXXXXXXXXXXXXXXXXX&amp;ll=XXXXXXXXXXXXXXXX&amp;spn=XXXXXXXXXXXXX&amp;output=embed


这是通过从我的URL中删除“ms”实现的

http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;msa=0&amp;msid=XXXXXXXXXXXXXXXXXXXXX&amp;ll=XXXXXXXXXXXXXXXX&amp;spn=XXXXXXXXXXXXX&amp;output=embed

像这样做

<iframe src="https://www.google.com/maps/d/u/0/embed?mid=1-VlXsvMWMr8EotfMcIwYKt-1SrI" width="320" height="350" style="margin-top:-387px"></iframe>

让我知道它是否有效

像这样做

<iframe src="https://www.google.com/maps/d/u/0/embed?mid=1-VlXsvMWMr8EotfMcIwYKt-1SrI" width="320" height="350" style="margin-top:-387px"></iframe>


让我知道它是否有效

好的..那么没有其他选择了吗?好的,那么除了这个没有别的选择吗?