Click here to Skip to main content
15,792,386 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
How do I find out if someone is using my webpage as an iframe or How do I prevent my webpage from getting iframed by other websites? Is there a special meta tag or a command for that?

What I have tried:

Hhhhhh.... Nothing.I can't figure anything out.I searched youtube but nothing worked!
Updated 18-Jul-21 23:45pm

1 solution

The simplest option is to send the X-Frame-Options header:
X-Frame-Options - HTTP | MDN[^]

This will work in Internet Explorer 8+, and all modern browsers.

For more complete control, set up a Content Security Policy (CSP), using the frame-ancestors directive:
Content-Security-Policy - HTTP | MDN[^]
CSP Cheat Sheet[^]
Report URI: Generate your Content Security Policy[^]

NB: The frame-ancestors directive is not supported by any version of Internet Explorer.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900