title: Create hyperlinks on certain words in Gmail message
body: <p>I am working on an extension for Chrome. I wish to create hyperlinks 1) for every certain words (using RegExp), 2) automatically (before display), 3) in gMail message.</p>
  
  <p>However, below codes doesn't work and gmail cannot load its message. Could you let me know why it happened and how I can fix it?</p>
  
  <p><strong>1.manifest.json</strong></p>
  
  <pre><code>{
      ...
      "content_scripts": [ {
          "js": [ "content.js" ],
          "matches": [ "&lt;all_urls&gt;" ],
          "run_at": "document_start",
          "all_frames": true
      } ]
      ...
  }
  </code></pre>
  
  <p><strong>2.content.js</strong></p>
  
  <pre><code>var doFilter = function(elem) {
      //ID Moderators &amp; URL parameters
      var internalID = new RegExp(/[1-9]\d{7,8}/g);
      var internalURL = 'https://mywebsite.com/go?customerId=';
  
      //Create Hyperlinks for Internal ID
      var internalMatch = elem.innerHTML.match(InternalID);
      for (var i=0; i&lt;internalMatch.length; i++) {
          elem.innerHTML = elem.innerHTML.replace(internalMatch[i], '&lt;a href="' + internalURL + internalMatch[i] + '"&gt;' + internalMatch[i] + '&lt;/a&gt;');
      }
  
  };
  
  window.addEventListener("DOMContentLoaded", function() {
      doFilter(document.body);
  });
  </code></pre>