Abhishek Asthana
Abhishek Asthana

Reputation: 226

Refused to display 'url' in a frame because it set 'X-Frame-Options' to 'DENY' in AngularJS

Everytime I try give my local address of the html file in iframe's src, it gives the error in console

Error

Refused to display 'url' in a frame  because it set 'X-Frame-Options' to 'DENY

Though there are some solutions, but they have solution in php or c#, I am using AngularJs, and I am very new to this.

Upvotes: 3

Views: 8399

Answers (2)

Ponmurugan Mohanraj
Ponmurugan Mohanraj

Reputation: 49

I have tried with meta tag. Setting the meta tag is useless. For instance,

<meta http-equiv="X-Frame-Options" content="deny">

has no effect. Do not use it!

Only by setting through the HTTP header like the examples below, X-Frame-Options will work.

To configure Apache to send the X-Frame-Options header for all pages, add this to your site's configuration:

Header always append X-Frame-Options SAMEORIGIN

To configure Apache to set the X-Frame-Options deny , add this to your site's configuration:

Header set X-Frame-Options DENY

To configure Apache to set the X-Frame-Options to ALLOW-FROM a specific Host , add this to your site's configuration:

Header set X-Frame-Options "ALLOW-FROM https://example.com/"

Upvotes: 1

Roshan Srivastava
Roshan Srivastava

Reputation: 476

Please add this meta tag on html page to resolve this issue

<meta http-equiv="X-Frame-Options" content="sameorigin">

Upvotes: -2

Related Questions