title: How to match youtube's url in a chrome extension?
body: <p>I am trying to make the simples chrome extension work in youtube (content script), but it doesn't seem to work correctly.</p>
  
  <p>Oddly enough it works some of the times, and some it simple doesn't.</p>
  
  <p>My final goal is to make it work only in the video URLs but I got stuck before that.</p>
  
  <p>I originally tried:</p>
  
  <pre><code>"matches": [ "http://www.youtube.com/*" ]
  </code></pre>
  
  <p>Without any success at all, which I found odd, so I guess that's my first question, since in another extension I made, it worked perfectly for <code>http://twitter.com/</code></p>
  
  <p>I read the code to some youtube extensions, and one used:</p>
  
  <pre><code>"matches": [ "*://*.youtube.com/*" ]
  </code></pre>
  
  <p>The weird thing is that this only works sometimes, and I can't reproduce/understand when. It definitely not works when I reload the page, but in some URLs it just works.</p>
  
  <p>The actual script is bare bones script for debugging:</p>
  
  <pre><code>$(window).load(function() {
      alert(2);
  });
  </code></pre>
  
  <p>So I'm pretty confused about this inconsistent behaviour. </p>
  
  <p>Edit:</p>
  
  <p>This url's don's seem to work:</p>
  
  <ul>
  <li><a href="http://www.youtube.com/watch?v=CFxuYWsXrC0" rel="nofollow">http://www.youtube.com/watch?v=CFxuYWsXrC0</a></li>
  <li><a href="http://www.youtube.com/watch?v=ZPY6JVcp55s" rel="nofollow">http://www.youtube.com/watch?v=ZPY6JVcp55s</a></li>
  </ul>
  
  <p>This do:</p>
  
  <ul>
  <li><a href="http://www.youtube.com/watch?v=k8v_l5iGJZM" rel="nofollow">http://www.youtube.com/watch?v=k8v_l5iGJZM</a></li>
  <li><a href="http://www.youtube.com/watch?v=ZPY6JVcp55s" rel="nofollow">http://www.youtube.com/watch?v=ZPY6JVcp55s</a></li>
  </ul>
  
  <p>Edit 2:</p>
  
  <p>Entire manifest:</p>
  
  <pre><code>{
    "name": "__MSG_extname__",
    "version": "0.1",
    "default_locale": "en",
    "manifest_version": 2,
    "icons": {
      "16": "images/icon16.png",
      "48": "images/icon48.png",
      "128": "images/icon128.png" },
    "content_scripts":[
      {
      "matches": [ "*://*.youtube.com/*" ],
      "js": ["jquery.min.js", "script.js"]
      }
    ],
    "web_accessible_resources": ["images/down-arrow.png"]
  }
  </code></pre>