9

I'm trying to embed some random sites in an iframe. I'm getting this error:

Refused to display document because display forbidden by X-Frame-Options.

I'm willing to respect their wishes and not embed it, but I'd like to be able to detect that this is set, so that I can try and reload another page. Is there an easy to way to do this in Javascript?

hugomg
  • 68,213
  • 24
  • 160
  • 246
A Question Asker
  • 3,339
  • 7
  • 31
  • 39

1 Answers1

0

You can do it either using CURL server side or using AJAX request. Either way, the idea is that you make a request to the website in question and simply check whether the response contains X-Frame-Options.

Gajus
  • 69,002
  • 70
  • 275
  • 438