title: how to get current tabId from background page
body: <p>how to get current tabId from background page?
  current tabId is the tab that user can see its content.</p>
  
  <p>background.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script&gt;
  
      if(typeof localStorage.state == 'undefined')
          localStorage.state = 'off'
      chrome.browserAction.onClicked.addListener(function(tab) {
          if(localStorage.state == 'on')
          {
              localStorage.state = 'off';
          }
          else
          {
              localStorage.state = 'on';
          }
          chrome.browserAction.setBadgeText({text: localStorage.state, tabId: tab.id});
          chrome.tabs.sendRequest(tab.id, {state: localStorage.state});
          //chrome.tabs.sendRequest(tab.id, {state: localStorage.state});
      });
      &lt;/script&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p></p>