拒绝执行内联事件处理程序,因为它违反了以下内容安全策略指令:" script-src' self' blob:文件系统

时间:2016-02-19 15:47:55

标签: javascript google-chrome google-chrome-extension

我只在Chrome扩展程序popup.html中使用以下锚点,当我点击锚点时,我收到错误

<a onclick="new Audio('https://dictionary.blob.core.chinacloudapi.cn/media/audio/tom/8a/e7/8AE76DF495E14441114FD06473DA2336.mp3').play();return false"><img src="img/voice.png" alt="voice"></a>

完整的错误输出是:

Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...')

0 个答案:

没有答案