title: xmlHttpRequest to get json file from project folder
body: <p>&quot;Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.&quot; always shows this whenever i tried to get json file through xmlHttpResuest. I have my  project on
  my hard disk. There is a .json file at the same folder where html,js,css files are. I run this project directly from the server. I need to get the json file from that html page using xmlHttpRequest. I can not use any local server.</p>
  <pre><code>function readTextFile(file, callback) {
  var rawFile = new XMLHttpRequest();
  rawFile.overrideMimeType(&quot;application/json&quot;);
  rawFile.open(&quot;GET&quot;, file, true);
  rawFile.onreadystatechange = function() {
      if (rawFile.readyState === 4 &amp;&amp; rawFile.status == &quot;200&quot;) {
          callback(rawFile.responseText);
      }
  }
  rawFile.send(null);
  }
  
  
  readTextFile(&quot;Game/test.json&quot;, function(text){
  var data = JSON.parse(text);
  console.log(data);
  </code></pre>
  <p>});</p>