According to Mozilla Developer Network, there are three options which are supported on either <frame>, <iframe> or <object>
elements:
- X-Frame-Options: DENY
- X-Frame-Options: SAMEORIGIN
Edited: From Dorner's comment, the below option is no longer supported and should not be used:
The first and last are definitely not what you need.
I tried with a local server to access another local server using:
X-Frame-Options: ALLOW-FROM http://localhost/
But I got a response: 'allow-from http://localhost/' is not a recognized directive. The header will be ignored.
It sort of worked because the header was ignored, yet you have to evaluate if that is desirable for your website. In that case it would just be simpler to ask your server to NOT send this header. But only do it if you understand the consequences for your project.
On IIS it can be done through web.config
with:
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Frame-Options" />
</customHeaders>
</httpProtocol>
</system.webServer>
For Apache, see this topic.
Just remember, it is up to your web browser to honor the header. Mozilla even states that as:
The added security is only provided if the user accessing the document is using a browser supporting X-Frame-Options.
I believe Edge is being more strict with this rule than Webkit for example.