Answer the question
In order to leave comments, you need to log in
How to allow my site to open in iframe for specific sites?
I need to allow certain sites to open my site in an iframe. The rest are banned. I read that it seems to be possible to do this using Content-Security-Policy, but I don’t quite understand how. Maybe there are other ways?
Answer the question
In order to leave comments, you need to log in
Found a better answer.
X-Frame-Options is considered a deprecated header.
It is recommended to use this:
Content-Security-Policy "frame-ancestors 'self' https://www.example.org ";
where https://www.example.org is a site that allows opening an iframe with your site
X-Frame-Options is not a panacea. Better hide the following JavaScript code on your site:
if (window != window.top) {
document.body.innerHTML = '';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question