Monday, May 30, 2011

jQuery doesn't suport ajax over the file protocol

I was playing with jQueryUI today, and a simple example like this failed to update an page.

        $.get('data1.xml', function(data) {

Running under Firefox4 locally on a PC (static local file protocols), I get errors like this inside Firebug:

Node cannot be inserted at the specified point in the hierarchy" code: "3

Turns out that this failure only occur when fetching local files because the same code works when deployed and run from a web server. Reading from a bug report here seems to indicate that jQuery AJAX doesn't support local file protocol.

Interestingly, an IE browser works with above code! And also the jQuery's load method like $('#main-panel').load('data1.xml'); works fine with local file!

No comments:

Post a Comment