2
我希望能够在chrome应用程序中通过input type =“file”打开文件。 下面的代码产生一个错误:如何在chrome应用程序中使用input type =“file”事件处理程序
Refused to execute inline event handler because it violates the following Content Security Policy directive
<html>
<head>
<title></title>
</head>
<body>
<input type="file" onchange="btnClick(event)" />
<script>
function btnClick(evt) {
var fileReader = new FileReader();
fileReader.onload = function (event) {
var str = event.target.result;
console.log(str);
}
fileReader.readAsText(event.target.files[0]);
}
</script>
</body>
</html>
我能做些什么来解决这个问题?
伟大的!谢谢。 – 31415926