How to check if website is loadable in iframe
html, iframe, javascript, x-frame-options
Solution
Check HTTP response header for X-Frame-Options. Facebook sends X-Frame-Options=DENY, which means "The page cannot be displayed in a frame, regardless of the site attempting to do so."
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>`. 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
Problem
I need to check, if website in `iframe` is loaded properly. On my website, users can `POST` custom website, which will show them in iframe. But some websites are protected from insert to iframe (such as google or facebook). How can I check, if is website loadable in iframe and can be used in iframe? PS: I haven't show any code, because I have no code and no idea how to do it. (My website runs on Java, so no Apache or PHP).