title: chrome extension, content script - cross domain request
body: <p>I'm writing a simple content script for chrome that reads text on webpages using google's tts api. The script works fine on domains under google.co.uk but not working on other pages.</p>
  
  <p>(help for usage: it plays selected text after '0' key pressed)</p>
  
  <p>manifest.json:</p>
  
  <pre><code>{
      "manifest_version": 2,
      "name": "text reader",
      "description": "text reader using google's text to speech api",
      "version": "0.1",
      "content_scripts": [{
          "matches": ["&lt;all_urls&gt;"],
          "js": ["tts.js"]
      }],
      "permissions": [
          "http://*/",
          "https://*/"
      ]
  }
  </code></pre>
  
  <p>tts.js:</p>
  
  <pre><code>function Tts() {
      var ttsurl = "https://translate.google.co.uk/translate_tts";
      var audio = new Audio();
      audio.onloadeddata = function() {
          audio.play();
      };
  
      this.read = function(text) {
          var url =  ttsurl + "?q=" + escape(text) + "&amp;tl=en";
          audio.src = url;
          alert(url);
      }
  }
  
  var tts = new Tts();
  
  document.onkeypress = function() {
      if(event.keyCode == 48) { //key '0' pressed
          var text = getSelection();
          tts.read(getSelection().toString());
      }
  }
  </code></pre>
  
  <p>Is there a nice way to make cross domain requests from a content script? I am happy to change settings of my browser too. What I tried: setting permission for all URLs (see manifest.json permissions)</p>