i to problema code in the google maps to js and don 't appear in website,in erorr code chromewebdata/:1拒绝在框架中显示'https://www.google.com/',因为它将'X-Frame-Options'设置为'sameorigin'。我的代码
import React from "react";
const GoogleMap = ({ extraClass }) => {
return (
<div className={`google-map__${extraClass}`}>
<iframe
title="Nusa Putra University Google Map"
src="https://www.google.com/maps/place/Nusa+Putra+University/@-6.9172783,106.8341234,14z/data=!4m20!1m13!4m12!1m4!2m2!1d106.8296372!2d-6.9262137!4e1!1m6!1m2!1s0x2e6836505836821d:0x619b6e8271f232cc!2snusaputra!2m2!1d106.8736239!2d-6.9053905!3m5!1s0x2e6836505836821d:0x619b6e8271f232cc!8m2!3d-6.9053905!4d106.8736239!16s%2Fg%2F1pzthfrxz?entry=ttu"
className={`map__${extraClass}`}
allowFullScreen
></iframe>
</div>
);
};
export default GoogleMap;
字符串
帮助我错误出现到网站
1条答案
按热度按时间pu3pd22g1#
拒绝在框架中显示'https://www.google.com/',因为它将'X-Frame-Options'设置为'sameorigin'。
Google服务器是sending a header that tells your browser you can't view that page in an iframe,这正是您要做的。
没有办法避开这个安全功能。
如果你想在你的网站上嵌入一个谷歌Map,你可以使用恰当的命名为Google Maps Embed API。