title: Accessing JSON service from localhost or file://
body: <p>I am making a html page intended to be run locally on a PC, preferably without a local server runing (file://). I am also using jQuery to make manipulation/AJAX a little easier.</p>
  
  <p>I am trying to load 2 results from the twitter API, but I get an error. The code is as follows:</p>
  
  <pre><code>$.getJSON("http://api.twitter.com/1/statuses/user_timeline.json?screen_name=someuser&amp;count=9", {},
      function (data) {
          $.each(data.items, doSomething1);
      });
  $.getJSON("http://search.twitter.com/search.json?q=somequery&amp;result_type=recent&amp;count=9", {},
      function (data) {
          $.each(data.items, doSomething2);
      });
  </code></pre>
  
  <p>I also tried the following code, but it didn't change the outcome.</p>
  
  <pre><code>$.getJSON("http://api.twitter.com/1/statuses/user_timeline.json",
      {
          count:          "9",
          screen_name:    "someuser"
      },
      function(data) {
          $.each(data.items, updateAWTweets);
      });
  $.getJSON("http://search.twitter.com/search.json",
      {
          q:              "somequery",
          result_type:    "recent",
          count:          "9"
      },
      function(data) {
          $.each(data.items, updateHashTagTweets);
      });
  </code></pre>
  
  <p>I get the following error in chrome (on a localhost server):</p>
  
  <pre><code>XMLHttpRequest cannot load http://search.twitter.com/search.json?q=somequery&amp;result_type=recent&amp;count=9. Origin http://localhost:62153 is not allowed by Access-Control-Allow-Origin.
  </code></pre>
  
  <p>or (with a file:// link)</p>
  
  <pre><code>XMLHttpRequest cannot load http://api.twitter.com/1/statuses/user_timeline.json?screen_name=someuser&amp;count=9. Origin null is not allowed by Access-Control-Allow-Origin.
  </code></pre>
  
  <p>Does anyone know how I can fix this?</p>