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:
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?
Turns out the cause of this problem was the browser ScriptSafe extension which was turned on. Disabling it solved the issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With