0

I want to use JQuery on the developers console when accessing the facebook website. However, I get this following error:

Refused to load the script 'https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js' because it violates the following Content Security Policy directive: "script-src blob: data: 'self' 'unsafe-inline' 'unsafe-eval' *.facebook.com *.fbcdn.net *.facebook.net *.google-analytics.com *.google.com *.fbsbx.com". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

The script that I used:

var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type (or see below for non wait option)
jQuery.noConflict();

I have searched online, and have read similar statements, but cannot see what the solution is if any to have it running in chrome developer on the facebook domain. It works well elsewhere for some places.

2
  • You could try github.com/PhilGrayson/chrome-csp-disable to disable CSP.
    – jabaa
    Commented Jun 6, 2023 at 16:14
  • Simply copyaste the contents of the script into devtools console and press Enter key, then run jQuery.noConflict(); To reuse it in the future use a devtools snippet.
    – woxxom
    Commented Jun 6, 2023 at 18:06

0