on 05-21-2021 3:40 PM
On our eShop we are trying to embed the pdf on jsp page via media relative url using getURL() method. Doing this in latest version of chrome 88+ it's blocking the content of media to be rendered while FireFox and IE Edge shows the pdf fine.
Any clues what need to be done?
I found solution that why chrome is blocking pdf media and it's because of an attribute in http response namely Content-Security-Policy which chrome is attaching in response with value as sandbox and thus it block the media. However this attribute isn't available in response on FF & IE.
So as a solution I found a document on sap where by local property media attribues can be added or value can be modified and hence added below property in local.properties file and things started working in chrome as usual:
media.set.header.Content-Security-Policy=disable
reference:
https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/2005/en-US/8c0f64c786691014aa95f9f6b572...
https://stackoverflow.com/questions/66205446/pdf-hosted-over-rest-interface-returns-err-blocked-by-c...
Hope this information may help others with same problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't know if it's going to work, but have you tried the `Media.downloadURL` attribute?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hey Geff Chang,
Thanks for replyinh. Yes I tried with all attributes avaiable in Media model with which url can be retreived and used to access the media but none worked for chrome. And as I mentioned with same media url things works on IE and FF.
Apparently I found solution that why chrome is blocking pdf media and it's because of an attribute in http response namely Content-Security-Policy which chrome is attaching in response with value as sandbox and thus it block the media. However this attribute isn't available in response on FF & IE.
So as a solution I found a document on sap where by local property media attribues can be added or value can be modified and hence added below property in local.properties file and things started working in chrome as usual:
media.set.header.Content-Security-Policy=disable
Hope this information may help others with same problem.
Thank you for sharing your findings. I think you should make it an official Answer and accept it. 🙂
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.