asok Buzz
asok Buzz

Reputation: 1894

Ignore X-frame-header using javascript

I would like to ignore X-frame header on my website so that iframe can load external websites. There are chrome extension like this one which works perfectly. How can I implement same concept through javascript?

Upvotes: 1

Views: 3645

Answers (1)

sideshowbarker
sideshowbarker

Reputation: 88388

You can’t use frontend JavaScript code running in a browser to cause the X-Frame-Options response header to be ignored. X-Frame-Options is a security feature designed in part as a defense against clickjacking attacks. If any site could just use some JavaScript code to cause browsers to ignore X-Frame-Options, that would pretty much make it completely useless.

That’s the reason why the only way you can cause it to be ignored in your own browser is by intentionally opting-in to insecure browsing by installing an extension as mentioned in the question.

But you can’t use JavaScript to force insecure browsing on other users by bypassing security features like X-Frame-Options that browsers have built-in support for.

Upvotes: 5

Related Questions