简体   繁体   English

如何检查网站是否可以在iframe中加载

[英]How to check if website is loadable in iframe

I need to check, if website in iframe is loaded properly. 如果iframe网站正确加载,我需要检查一下。 On my website, users can POST custom website, which will show them in iframe. 在我的网站上,用户可以POST定制的网站,这将让他们在iframe中。 But some websites are protected from insert to iframe (such as google or facebook). 但是一些网站受到保护,不会插入到iframe(例如google或facebook)。

How can I check, if is website loadable in iframe and can be used in iframe? 我该如何检查iframe网站是否可以加载并且可以在iframe中使用?

PS: I haven't show any code, because I have no code and no idea how to do it. PS:我没有显示任何代码,因为我没有代码,也不知道怎么做。 (My website runs on Java, so no Apache or PHP). (我的网站运行在Java上,所以没有Apache或PHP)。

Check HTTP response header for X-Frame-Options . 检查X-Frame-Options的 HTTP响应标头。 Facebook sends X-Frame-Options=DENY, which means "The page cannot be displayed in a frame, regardless of the site attempting to do so." Facebook发送X-Frame-Options = DENY,这意味着“无论网站是否尝试这样做,页面都无法在一个框架中显示。”

The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame> , <iframe> or <object> . X-Frame-Options HTTP响应头可用于指示是否应允许浏览器在<frame><iframe><object>呈现页面。 Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites. 站点可以通过确保其内容未嵌入到其他站点中来避免点击劫持攻击。

Check this: Accessing the web page's HTTP Headers in JavaScript 检查: 在JavaScript中访问网页的HTTP标头

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

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