LoginSignup
simasimanekosan
@simasimanekosan (sima neko)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

chrome拡張機能を作成していたのですが、javascriptが使えません。対処法はないですか

htmlでjavascriptを使って見たら、

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval' 'inline-speculation-rules' http://localhost:* http://127.0.0.1:*". Either the 'unsafe-inline' keyword, a hash ('sha256-Lt6LaaOCGTY7/oe0aHNuNye9X2EiVEJBnBwVvBYueQs='), or a nonce ('nonce-...') is required to enable inline execution.

というエラーが出ました。
誰か教えてください

0

3Answer

chrome拡張機能を作成していたのですが、javascriptが使えません。

多分、javascriptが使えないのではなく、あなたがjavascriptを使いこなしていないと思います。

エラーのみの掲載だけでなく、コードが正しいなら堂々とコードを掲載してはどうでしょう?javascriptが使えないことを誰か証明してくれるかもしれませんよ?

p.s. 単純にjavascriptの http://localhost:* 要求に対して サーバーが Refused してるのでは?

0

拡張機能でのインラインスクリプトの実行はコンテンツセキュリティポリシーによってブロックされます。

回避するには、以下のページを参考に、エラーメッセージに含まれるハッシュ値をマニフェストファイルの content_security_policy に設定して実行を許可してください。インラインスクリプトを書き換えるとハッシュ値も変わるため、都度設定し直す必要があります。

0

Your answer might help someone💌