0

I'm needing to use functions from js file which i keep in another server on ext, but when i embed in style

<script src="http://localhost:3000/weather.js">

Then it gives error:

Refused to load the script 'http://localhost:3000/weather.js' because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

So is there any solution for me? I simply want when I click a button to execute the method located in the weather.js file:

const main = () =>{
    console.log("Success!!!")
}
tets = document.querySelector(".btn-test")
test.onclick = () =>{
    main()
}
BinChanhKun
  • 73
  • 2
  • 8
  • Does this answer your question? [Refused to load the script because it violates the following Content Security Policy directive](https://stackoverflow.com/questions/31211359/refused-to-load-the-script-because-it-violates-the-following-content-security-po) – jeremy-denis Sep 21 '22 at 06:21
  • this no working for me :((( – BinChanhKun Sep 21 '22 at 09:27
  • 1
    ManifestV3 disallows external scripts by design. – wOxxOm Sep 21 '22 at 16:52

1 Answers1

0

I think you missed the HTML close tag, you can try it

<script type = "text/javascript" src="http://localhost:3000/weather.js"></script>

I think it will work.