0

I want to filter a list of urls in React so I can load only ones that will load in an iframe. Several fail to load because of X-frame-options: DENY or X-frame-options: sameorigin and I want to filter those out. I can't find a way to do this without actually creating an iframe for each url and then checking if it loads. That approach would be way too slow for me.

  • 1
    You can't tell unless you fetch the content. Any URL might be dynamic, so even if it worked on one try it might not work the next time. – Pointy Jun 10 '19 at 19:48
  • Read the `X-Frame-Options` [header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) value and check if the `url` is allowed or not. See [Accessing the web page's HTTP Headers in JavaScript](https://stackoverflow.com/a/4881836/4228942) – Sam R. Jun 11 '19 at 00:28

0 Answers0