相关疑难解决方法(0)

Chrome扩展弹出窗口无效,点击事件无法处理

我创建了一个JavaScript变量,当我点击按钮时它应该增加1,但它没有发生.

这是manifest.json.

{
  "name":"Facebook",
  "version":"1.0",
  "description":"My Facebook Profile",
  "manifest_version":2,
  "browser_action":{
    "default_icon":"google-plus-red-128.png",
    "default_popup":"hello.html"
  }
}
Run Code Online (Sandbox Code Playgroud)

这是html页面的代码

<!DOCTYPE html>
<html>
<head>
<script>
var a=0;
function count()
{
  a++;
  document.getElementById("demo").innerHTML=a;
  return a;
}
</script>
</head>
<body>
<p id="demo">=a</p>
<button type="button" onclick="count()">Count</button>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我希望扩展程序向我显示a的值,并在每次单击扩展名或按钮时将其递增1

扩展的图片

javascript google-chrome button google-chrome-extension content-security-policy

27
推荐指数
1
解决办法
4万
查看次数