我的扩展程序无法正常工作

时间:2016-04-05 09:09:58

标签: javascript html google-chrome-extension

已更新

我是Chrome扩展程序设计的新手。我写了一个简单的扩展,点击将打开我经常打开的所有标签。但是当我点击扩展按钮时,只有2个链接从数组URL打开。继承我的代码

的manifest.json

{
  "manifest_version": 2,
  "name": "My tabs",
  "version": "1.0",
  "description": "My first Chrome extension.",
  "browser_action": {
    "default_popup": "main.html"
  },
  "permissions" : ["tabs"],
  "offline_enabled": true
}

main.html中

    <!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type = "text/javascript" src = "popup.js"></script>
</head>
<body id = "waste">
</body>
</html>

popup.js

var url = new Array(
    "https://www.quora.com/",
    "https://www.youtube.com/",
    "https://mail.google.com/mail/u/0/")
    function OpenInNewTab(url) {
    for(i=0; i<url.length ;i++) {
    var win = window.open(url[i], '_blank');
    }
    }
window.onload = OpenInNewTab(url);
//document.getElementsById("waste").onload = OpenInNewTab(url);

是否有任何事情要检查状态或监控扩展程序,以便我可以检查我的代码有什么问题。提前致谢

0 个答案:

没有答案