Is there an attribute for iframes that will make it block requests to certain domains? Something like the following:
<iframe src="www.example.com" block-domains="google.com"></iframe>
So if block-domains
is that magical attribute I'm looking for, it's telling the iframe to block all requests to google.com
.
I believe the closest you can get to this is by setting X-Frame-options in the HEADER declaration. The documentation here states that you can provide any one of the 2 following options (the 3rd being obsolete):
Another work around might be to use frame-ancestors as part of content security policy header, that will allow you to specify sites on which the iframe can be embedded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With