问题描述:
当开发chrome扩展时,页面的popup.html中需要js的时候,直接将js写在动态绑定js事件会提示:
refused to execute inline script because it violates the following content security policy directive: “script-src ‘self' chrome-extension-resource:”..
解决办法:
在popup.html中引用外部的js文件动态绑定js事件,例如:
复制代码 代码如下:
test.js中:
复制代码 代码如下:
var listbox = document.getelementbyid(showlist);
listbox.onclick=function(){
document.getelementbyid(player_sidebar).style.width = 100;
}
