title: chrome.webRequest.onBeforeRequest.addListener Cannot read property 'onBeforeRequest' of undefined
body: <p>I'm trying to build my own chrome extension and I'm trying to add an event handler using <code>onBeforeRequest</code>.</p>
  
  <p>My <code>manifest.json</code>:</p>
  
  <pre><code>{
      "manifest_version": 2,
  
      "name": "My extension",
      "description": "some descrpition",
      "version": "1.0",
      "permissions": [
          "activeTab",
          "tabs",
          "webRequest",
          "webNavigation",
          "management",
          "http://*/*",
          "https://*/*"
      ],
      "background": {
          "scripts": [
              "js/jquery-2.1.4.min.js",
              "js/background.js"
          ],
          "persistent": true
       },
      "browser_action": {
          "default_icon": "imgs/img.png",
          "default_title": "extension"
      },
      "icons" : {
        "64" : "imgs/vergrootglas.png"  
      }
  }
  </code></pre>
  
  <p>My <code>background.js</code>:</p>
  
  <pre><code>function callback(param1,param2,param3){
      alert(param1);
      alert(param2);
      alert(param3);
  }
  //alert("test");
  
  
  
  chrome.webRequest.onBeforeRequest.addListener(callback);
  </code></pre>
  
  <p>I got this loaded into my chrome. But everytime I get this message in my console:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'onBeforeRequest' of
    undefined</p>
  </blockquote>
  
  <p>I can't figure out what I'm oding wrong, I've found this:
  <a href="https://developer.chrome.com/extensions/webRequest" rel="noreferrer">https://developer.chrome.com/extensions/webRequest</a></p>
  
  <p>But  the example of the code seems to be quite the same as what I do.
  What am I missing here?</p>