title: Open a URL at a specific time with a Chrome Extension
body: <p>I have a Chrome extension that I am using to run some batch jobs on a site in the early hours of the morning. I already have a content script in place to run when this URL is called in Chrome and complete all the necessary jobs. I'm having a problem now figuring out the best way to string this to a scheduler so this URL gets opened automatically in a Chrome tab at 3:00 am. I am running all this code in a dedicated Azure Virtual Machine so there won't be any user logged in when the script is set to run. When the new tab has finished it's work it will close automatically, this I have already handled.</p>
  
  <p>So far I have experimented with using the Windows Task Scheduler to open Chrome with the URL passed in as an argument. This method however is proving to be somewhat unreliable!</p>
  
  <p>If I leave Chrome open on the Virtual Machine, is there any native Chrome API I can use to open a tab at a specific time with a URL? I've also used the following javascript function in a separate page to trigger the URL to open, however I have no mechanism to test if it's already running in another tab so this code would result in endless new tabs being opened, unless it could be adapted to check if the URL is already open, and I think this will be outside the scope of Javascript on it's own.</p>
  
  <pre><code>var myUrlToCall = "http://www.myspecialurl.com/runme.html";
  
  //IS 3 AM YET?
  function runTimer() {
      setTimeout(function () {
          var dtNow = new Date();
          var hoursNow = dtNow.getHours() * 1;
          if (hoursNow &gt;= 3) {
              //Open new window here (but how can I know if it's already open?)
              window.open(myUrlToCall);
          } else {
              runTimer();
          }
      }, 3000);
  }
  </code></pre>
  
  <p>Any thoughts on this would be much appreciated.</p>