避免“拒绝显示到‘SAMEORIGIN’ www.google.co.in/maps/place/”的替代解决方案

Nee*_*hit 2 iframe google-maps

我需要在用户的个人资料页面上显示 Google 地图,最终用户将添加 Google 地图 URL。为此,用户可以在 Google 上搜索位置,并可以复制 Google 提供的 Google 地图 URL 作为结果。这是最终用户获取 Google 地图 URL 的最简单方法。

在 中显示 Google 地图 URLiframe时,出现以下错误:

拒绝显示“ https://www.google.co.in/maps/place/Prince+Bijoy+Memorial+Hospital/@28.012196,73.326442,15z/data=!4m2!3m1!1s0x0:0x9e25cc2a3dc80115&output=embed在”框架,因为它将“X-Frame-Options”设置为“SAMEORIGIN”。

这是示例网址:

https://www.google.co.in/maps/place/Prince+Bijoy+Memorial+Hospital/@28.012196,73.326442,15z/data=!4m2!3m1!1s0x0:0x9e25cc2a3dc80115

我的iframe

<iframe src="https://www.google.co.in/maps/place/Prince+Bijoy+Memorial+Hospital/@28.012196,73.326442,15z/data=!4m2!3m1!1s0x0:0x9e25cc2a3dc80115" height="800" width="800"></iframe>
Run Code Online (Sandbox Code Playgroud)

注意:我在网络上搜索了有关该问题的信息,但没有找到任何提供生成 Google 地图 URL 的简便方法的解决方案。

请分享建议。

prc*_*rcu 5

您需要使用嵌入 api https://support.google.com/maps/answer/3544418?hl=en。只需点击地图左下角的齿轮,然后点击“分享和嵌入地图”,然后点击“iframe”。