html - 无法在 html 中显示 iframe
问题描述
我正在尝试添加iframe,但出现错误。这是我的代码:
<html>
<head>
<title>Adding Iframe</title>
</head>
<body>
<iframe src="https://www.google.com/" height="300px" width="100%" name="iframe_a" id="if1">
</iframe>
</body>
</html>
代码笔: https ://codepen.io/multanisadik/pen/xxKmVeB
谁能帮我?
解决方案
您不能在 iframe 中显示谷歌。大多数知名网站都屏蔽了这些功能。
原因是,他们发送了一个名为X-Frame-Options: SAMEORIGIN的响应头。此选项可防止浏览器显示 iframe。
推荐阅读
- android - 附近警察局的谷歌地图API
- mongodb - mongodb 在 commitTransaction 失败后我需要 abortTransaction 吗?
- vba - 如何比较在excel中有两列的两组数据?下面的图片会详细说明
- python - 将 OpenCv Mat 从 C++ 传递到 Python
- python - Python zipfile 不会解压缩 Windows zip 存档的文件夹
- json - 当 JSON 键包含连字符时,在 bigquery 中创建表失败
- javascript - npm install bcrypt 安装失败
- javascript - 节点的微服务架构是否会降低效率并增加响应时间?有什么解决办法还是我的理解有误?
- java - 无法解决 maven 项目 eclipse photon 中的错误
- tensorflow - 如何直接通过特征制作嵌入列?