title: Why is chrome.cookies undefined in a content script?
body: <p>Whenever I try to read from a cookie using the <code>chrome.cookies.get()</code> function I get this error:</p>
  
  <pre><code>TypeError: Cannot read property 'get' of undefined.
  </code></pre>
  
  <p>I am calling the function in my content.js file, and it will only run on twitter.com(that part works).</p>
  
  <p>Here is my manifest file:</p>
  
  <pre><code>{
    "manifest_version": 2,
  
    "name": "Twitter-MultiSignin",
    "description": "twiter sign in",
    "version": "1.0",
    "permissions": [ "cookies", "alarms" , "http://*/*", "https://*/*", "storage"],
    "content_scripts": [{
      "matches": ["http://twitter.com/*","https://twitter.com/*"],
      "js": ["jquery.js","content.js"]
    }],
    "browser_action": {
      "default_icon": "icon.png",
      "default_popup": "popup.html"
    }
  }
  </code></pre>
  
  <p>Here is my content.js (it always alerts on the twitter page so that works fine):</p>
  
  <pre><code>$(function() {
      alert('got here');
      try{
          chrome.cookies.get({ url: 'https://twitter.com', name: 'auth_token' }, function (cookie){
              alert(cookie.value);
          });
      }catch(err){
          //do nothing
          alert(err);
      }
      try{
          chrome.cookies.get({ url: 'https://twitter.com', name: 'twid' },
          function (cookie) {
              if (cookie) {
                twid_raw = cookie.value;
                twid = twid_raw.split('=')[1]
                alert(twid);
              }
              else{
                  alert("not found");
              }
          });
      }catch(err){
          //do nothing
      }
  })
  </code></pre>