0

UPDATED

I am new to chrome extension programming. I wrote a simple extension which clicked will open all tabs which i regularly open. But when i clicked on extension button only 2 links open from the array url. Heres my code

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);

Is there any thing to check status or monitor the extension so that i can check what's wrong with my code. Thanks in advance

Himanshu Bansal
  • 475
  • 4
  • 19
  • Use `default_popup` instead of popup, and also window.onload – Rob W Apr 05 '16 at 11:59
  • @RobW thank you for your help its working now but when i press the button it only opens first 2 links in the array. I don't know why – Himanshu Bansal Apr 05 '16 at 13:05
  • Changing the meaning of the question after receiving an answer is frowned upon on Stack Overflow. Please don't do that again in the future. You're still asking how to debug the popup script, the answer is still the same. As for why only two links are opened: I guess that it's either a rate-limit, or the popup closes after the second tab was opened, which halts the execution. – Rob W Apr 05 '16 at 18:16

0 Answers0