RubbleFord
RubbleFord

Reputation: 7636

Content-Security-Policy + frame-ancestors

I'm trying to prevent my content being loaded into an IFrame, so I implemented the Content-Security-Policy header:

Response.AddHeader("Content-Security-Policy", "frame-ancestors *.twitter.com");

On purpose to test in various browsers I set it to twitter, in the hope when I framed my content it would break.

However I get the following warning in chrome yet the content is still shown.

Refused to display 'http://corsupport.azurewebsites.net/sandbox in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors *.twitter.com".

Fairly new to this policy so any advice would be great.

I've successfully implemented

Response.AddHeader("Access-Control-Allow-Origin", 'http:localhost:61021');    

Upvotes: 4

Views: 8256

Answers (1)

Related Questions