title: develop screenshot chrome extension
body: <p>i saw a lot of answers here but no one is what i'm looking for.
  i want to take screenshot from chrome extension just for the screen i see at the first time without scrolling the page.
  and "alert" the created file base64 path.</p>
  
  <p>i have all the right permissions:</p>
  
  <pre><code>"permissions": [
    "activeTab",
    "tabs" ,
    "storage",
    "unlimitedStorage",
    "browsingData",
    "notifications",
    "http://*/*",
    "https://*/*",
    "file://*/*",
      "background" // added after i got the answer
  ],
   "background": { // added after i got the answer
      "scripts": [
          "js/background.js"
      ]
  },
  </code></pre>
  
  <p>in my manifest.json</p>
  
  <p>i also have the code: </p>
  
  <pre><code>$(document).ready(function() {
      alert("1");
      chrome.tabs.captureVisibleTab(null, {}, function (image) {
        alert("2"); 
      });
  });
  </code></pre>
  
  <p>i got 1 all the time but 2 i never get and i don't know why. please help..</p>
  
  <p>thanks ..</p>
  
  <p>UPDATE</p>
  
  <p>that's the missing part (background.js)</p>
  
  <pre><code>        chrome.runtime.onMessage.addListener(
  function(request, sender, sendResponse) {
      chrome.tabs.captureVisibleTab(
          null,
          {},
          function(dataUrl){
              sendResponse({imgSrc:dataUrl});
          }); //remember that captureVisibleTab() is a statement
      return true;
  }
  );
  </code></pre>
  
  <p>and then :</p>
  
  <pre><code>       chrome.tabs.captureVisibleTab(null, {}, function (image) {
        // alert("2");
              alert(response.imgSrc); 
      }); 
  </code></pre>