title: How do I get around Cross Origin Requests being blocked?
body: <p>I'm trying to retrieve a file, on the server that I run my php on.  A web hosting service.</p>
  <p>I've encountered this problem before, trying to access a file from html either locally, or from a server.  My code is:</p>
  <pre><code>&lt;! DOCTYPE html &gt;
  
  &lt;html&gt;
     &lt;head&gt;
         &lt;title&gt;retrieve_activities_json.html&lt;/title&gt;
     &lt;/head&gt;
     &lt;body&gt;
     
         &lt;p id=&quot;demo&quot;&gt;&lt;/p&gt;
         
         &lt;script&gt;
         var xmlhttp = new XMLHttpRequest();
         xmlhttp.onreadystatechange = function() {
             if( this.readystate == 4 &amp;&amp; this.status == 200 ) {
                 var activities_obj = JSON.parse(this.responseText);
                 document.getElementById('demo').innerHTML = activities_obj[0];
             }
     
         };
     
         xmlhttp.open(&quot;GET&quot;,&quot;activities.json&quot;, true);
         xmlhttp.send();
         
         &lt;/script&gt;
     &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  <p>Is there any settings to my browser, or to the webhosting server that will help me defeat this error message:</p>
  <p>Access to XMLHttpRequest at 'file:///D:/Web%20Development%20Tutorials/JavaScript%20Practice/activities.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.</p>