title: Chrome Extension - Context Menu On Specific Pages
body: <p>I am wondering if it is possible to show the following context menu item only if it is on specific pages.</p>
  
  <p>I think it has something to do with <b>documentUrlPatterns</b> (Which can be seen <a href="http://developer.chrome.com/extensions/contextMenus.html#property-createProperties-documentUrlPatterns" rel="noreferrer">here</a> as of typing this) but I am not sure how to implement it with the following code:</p>
  
  <p><br><hr></p>
  
  <p>manifest.json</p>
  
  <pre><code>{
      "name": "App Name",
      "version": "1.0",
      "manifest_version": 2,
      "description": "Description",
  
      "permissions": [
          "contextMenus",
          "tabs"
       ],
  
      "background": {
          "scripts": ["script.js"]
      }
  }
  </code></pre>
  
  <p><br></p>
  
  <hr>
  
  <p>script.js</p>
  
  <pre><code>function getword(info,tab) {
      chrome.tabs.create({ 
          url: "http://www.google.com/search?q=" + info.selectionText,
      })
  }
  
  chrome.contextMenus.create({
  
      title: "Search: %s", 
      contexts:["selection"], 
      onclick: getword,
  
  });
  </code></pre>
  
  <p><br><hr></p>
  
  <p>It would be great if you could provide a demo which will only work on specific sites of your choice (For instance, any directory of Stack Overflow and any directory of Google).</p>
  
  <p>PS. The above code allows users to make a selection on any site and provides a button (In the context menu) which will search for what the user has selected on <a href="http://www.google.com/search?q=" rel="noreferrer">http://www.google.com/search?q=</a> {Selection}</p>