Friday, April 15, 2022

[FIXED] How would set a response header X-Frame-Options?

Issue

I need help with setting a response header for my site, hosted on Github pages. How would I set the X-Frame-Options option to DENY? I could use HTML, CSS, JS, or PHP.

I have tried using <meta http-equiv="X-Frame-Options" content="deny"> but I got this message in console:

X-Frame-Options may only be set via an HTTP header sent along with a document. It may not be set inside <meta>.

UPDATE

Since I can not edit the headers because my site is hosted on GitHub, is there a way to check if the page is in an iframe and display an image instead of the content?

Any ideas are appreciated!


Solution

You can't.

Github pages does not provide any mechanism for customising HTTP response headers (including running server-side code in any programming language).



Answered By - Quentin
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.