简体   繁体   English

无法使用iframe加载外部网站

[英]unable to load external website using iframe

i am trying to load external website on my webpage using i frame but its giving following error on console. 我正在尝试使用i框架将外部网站加载到我的网页上,但是在控制台上显示了以下错误。

here is my code 这是我的代码

 <body>
  <iframe src="https://firebase.google.com/"> </iframe>
 </body>

error on console 控制台错误

Refused to display 'https://firebase.google.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

i try different solution but its not working .how to solve this problem? 我尝试不同的解决方案,但无法正常工作。如何解决此问题?

Based on the error I think you need to change the 'X-Frame-Options' to allow the site to be loaded (if you have access to the server). 基于错误,我认为您需要更改“ X-Frame-Options”以允许加载站点(如果您有权访问服务器)。 Follow this link to know how to do that. 请点击此链接以了解操作方法。

However, if the domain that you are trying to access is setting the 'X-Frame-Options' to sameorigin then you can't display it in an iframe. 但是,如果您要访问的域将“ X-Frame-Options”设置为sameorigin,则无法在iframe中显示该域。 This question is similar to yours. 这个问题和你的相似。 Have a look at it. 看看它。

You can't. 你不能

The X-Frame-Options header is meant precisely to prevent the page from being loaded in an iframe. X-Frame-Options标头正是为了防止将页面加载到iframe中。 eg to prevent clickjacking attacks. 例如,防止点击劫持攻击。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM