Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content Security Policy directive: "script-src 'none' Violation Error

I have just installed MAMP and created 2 files in the htdocs folder:

  • index.html

    <!doctype html>
    <html>
        <body>Test Page</body>
        <script src="script.js"></script>
    </html>
    
  • script.js

    console.log("works");
    

MAMP is configured to the following ports:

  • Apache Port: 8888
  • Nginx port: 7888
  • MySQL port: 8889

Opening localhost:8888 gives the following error in console:

Refused to load the script 'http://localhost:8888/script.js' because it violates the following Content Security Policy directive: "script-src 'none'".

I have never encountered CSP before, so this has left me bewildered. What is causing this issue?

like image 344
feetnappy Avatar asked Jun 08 '17 15:06

feetnappy


1 Answers

Turns out the cause of this problem was the browser ScriptSafe extension which was turned on. Disabling it solved the issue

like image 150
feetnappy Avatar answered Oct 09 '22 19:10

feetnappy