NETWORK_ERR: XMLHttpRequest Exception 101

I'm having an AJAX problem in Chrome, giving the following error:

Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101

This is my code:

function IO(filename) {
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        xmlhttp = new XMLHttpRequest();

    } else if (window.ActiveXObject) { // IE
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) { }
    }"GET", filename+"?random="+Math.floor(Math.random()*100000001), false);

        return xmlhttp.responseXML;


The solution is setting the async parameter to true:"GET", filename+"?random="+Math.floor(Math.random()*100000001), true);

In addition to happening when fetching a cross-site URL without proper headers, this error occurs when fetching a local file via XHR (AJAX). Apparently Chrome is being overzealous with its cross-site security measures, not realizing that one file: URL should be considered the same site as another file: URL. This is a problem for many homegrown apps, especially Jasmine (a JavaScript testing framework).

Still happening as of Chrome version 16.0.912.63 .

I don't know any solution. Workaround is to use Firefox, or any other browser, to run apps served off of file: URLs.

Need Your Help

How to remove an object from a list collection?

c# .net

I had to change on my lines of code around. I before had something like this