Origin null is not allowed by Access-Control-Allow-Origin (Synchronous, no jQuery)
<p>The first thing I would like to say is that I looked around for an answer to this for quite some time, but everything I found was about jQuery. This is not about jQuery.  </p>

<p>I have some code (below), but when I ran it in Firefox then Firebug gave me this big, incomprehensible exception. I tried it in Google Chrome and got something a bit more useful: "XMLHttpRequest cannot load <a href="http://www.wikipedia.org/" rel="nofollow">http://www.wikipedia.org/</a>. Origin null is not allowed by Access-Control-Allow-Origin." (If you'd like to know why I was trying to access Wikipedia, I often use it as a test site.)
Here is my code:</p>

<pre><code>function requestSite(url) {
    var xmlhttp;
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    }
    else {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET", url, false);
    xmlhttp.send();
    return xmlhttp;
}
</code></pre>

<p>All I tried to do with it was access Wikipedia. Then Google, which gave me the same result. Perhaps it is worth noting that when I triggered the function with a button on the page, it gave me this, while using the console was exactly the same, but without the error message. Another thing that may or may not be worth mentioning is that I was running this file from my local filesystem.</p>
