goblenro
(Goblenro)
April 18, 2018, 12:43pm
1
When I try to submit data from addon to an external website using jquery post from content_scripts I get this error:
Content Security Policy: The page’s settings blocked the loading of a resource at https://www.test.com/ (“connect-src”).
I understand that this type of error can be fixed using background js, but I can’t find any example or information how exactly to do this.
Anyone can help me with an example please?
Thank you.
NilkasG
(Niklas Gollenstede)
April 18, 2018, 5:59pm
2
Assuming that jQuery uses XHRs, you should be able to POST from a content script, if you have a host permission for the target:
At least one would hope that the pages CSP doesn’t interfere with this.
goblenro
(Goblenro)
April 19, 2018, 5:26am
3
Addon is running on facebook website. Using XMLHttpRequest I don’t have that error, instead in both cases action is not made on target website, in console I have a call request to https://www.facebook.com/ajax/bz