Opening a PDF embedded in iframe in chrome with content security policy > plugin-types -
i have csp (content-security-policy) plugin-types policy set white-list pdf type below. when trying open pdf file in iframe src attribute, working browsers ie 11, , firefox 47+ failing in chrome 50+. else required make working in chrome?
content-security-policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; object-src 'self'; style-src 'self'; frame-src 'self' plugin-types application/pdf;
error in chrome console
resource interpreted document transferred mime type application/pdf refused load 'http://127.0.0.1/module123/open.do?id=10000' (mime type '') because violates following content security policy directive: 'plugin-types application/pdf'. when enforcing 'plugin-types' directive, plugin's media type must explicitly declared 'type' attribute on containing element (e.g. '<object type="[type goes here]" ...>').
i had similar problem.
to resolve problem, needed add blob: object-src directive.
also, did not need specify plugin-type.
so be:
content-security-policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; object-src 'self' blob:; style-src 'self'; frame-src 'self';
Comments
Post a Comment