PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, December 28, 2021

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

 December 28, 2021     apache, content-security-policy, html, javascript, mamp     No comments   

Issue

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?


Solution

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



Answered By - feetnappy
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing