title: In Chrome extension, content_scripts matches are being ignored
body: <p>I am new to javascript and attempting to learn Chrome extensions.  I have searched every variation of my question I can think of but the answers I've found don't work for my specific problem.  I have gone through the tutorials for chrome extensions and what I think should be working does not in fact work.</p>
  
  <p>The extension I wrote has no html page, just an icon as it should run all the time.  It actually works perfectly, blocking calls to a certain chat program to prevent the chat window from opening.  It was written for testers who have to be on a site a long time and don't want to keep closing the chat window.</p>
  
  <p>The problem is that the extension works for all websites, and I only want it to work for one website.  That is, the chat window is also blocked when the user is on other websites that use the same chat software.</p>
  
  <p>What I read led me to believe that putting a match to the website I want to use in the content_scripts block of the manifest.json would cause the extension to only run in that matched site.  It does not work.  In fact, if I take the content_scripts block out of the manifest file entirely, the extension works exactly the same. The javascript function is called and the chat window is blocked.  So for some reason the content_scripts block is being ignored.  As a javascript noob, I guess I must be missing a crucial step.  I got most of this code from examples and just modified it slightly. Can anyone help?</p>
  
  <p>manifest.json:</p>
  
  <pre><code>    {
    "manifest_version": 2,
      "version": "1.0",
    "name": "ChatBlock",
    "description": "Shut down liveperson chat on mywebsite.com before it runs.",
  
    "permissions": [          
      "tabs",
      "webRequest",
      "webRequestBlocking",
      "*://sales.liveperson.net/"
     ],
     "web_accessible_resources": ["jquery-1.10.2.min.js"],
     "content_scripts": [
      {
        "matches": ["*://*.mywebsite.com/*"],
        "js": ["jquery-1.10.2.min.js"]
      }
     ],
     "browser_action": {
      "default_icon": "chatblockIcon.png"
     },
     "background": {
      "scripts": ["avoid.js"]
     }
  
    }
  </code></pre>
  
  <p>javascript file (avoid.js):</p>
  
  <pre><code>chrome.webRequest.onBeforeRequest.addListener(
    function(details) {   
      return {
          cancel: true
          }; 
    },
    {urls: ["*://sales.liveperson.net/*"]},
    ["blocking"]);
  </code></pre>
  
  <p>EDIT: I have removed the references to jquery from my manifest.  The tool still works without it just the same, so the comment below was correct, it was not needed - thanks @ExpertSystem.  But the blocking still occurs on all websites. I had previously (before posting this question) tried @ExpertSystem's second suggestion of explicity checking the tabs for the desired website, or checking the referrer, but I was not able to find the correct javascript syntax to make it work.  Also, I am very interested in using the "matches" property if possible so the javascript is more generic.  I am still confused as to why "matches" is not working - what am I doing wrong with regard to the matches property?</p>
  
  <p>New version of Manifest.json:</p>
  
  <pre><code>{
    "manifest_version": 2,
      "version": "1.0",
    "name": "ChatBlock",
    "description": "Shut down liveperson chat on myWebsite.com before it runs.",
  
    "permissions": [          
      "tabs",
      "webRequest",
      "webRequestBlocking",
      "*://sales.liveperson.net/"
     ],
     "content_scripts": [
      {
        "matches": ["*://*.myWebsite.com/*"],
        "js": ["avoid.js"]
      }
     ],
     "browser_action": {
      "default_icon": "chatblockIcon.png"
     },
     "background": {
      "scripts": ["avoid.js"]
     }
  
    }
  </code></pre>