Reputation: 1822
:)
I am loading a Chrome into Facebook and I do a simple JQuery GET request to my own website. I get the following error in the console when the GET request is called...
"Refused to connect to 'https://www.istyla.com/Popup/t2.php' because it violates the
following Content Security Policy directive: "connect-src https://*.facebook.com
http://*.facebook.com https://*.fbcdn.net http://*.fbcdn.net *.facebook.net
*.spotilocal.com:* https://*.akamaihd.net ws://*.facebook.com:* http://*.akamaihd.net"."
This happened all of a sudden. It worked yesterday...
Here is part of my Chrome Extension Manifest with the CSP definition:
"content_security_policy": "default-src 'self'; script-src 'self'; object-src 'self'; connect-src *"
Here is my GET request (loaded via a content script - JQuery is also loaded as a seperate content script):
$.get("https://www.istyla.com/Popup/t2.php" + c, function (d) {
//do my other stuff here
}
By the way... t2.php does allow all origins. Is it Facebook that set a CSP on their site?? What can I do to connect to my URL via JQuery GET?
Thanks for any advice... :)
Upvotes: 4
Views: 1108
Reputation: 224
I had the same issue with my script. I moved all my AJAX calls to a background script.
Upvotes: 4
Reputation: 8532
I think a direct .get would not work cross-domain. Can you try using $.jsonp. http://www.jquery4u.com/json/jsonp-examples/
Upvotes: -3