diff --git a/localXHR.js b/localXHR.js new file mode 100644 index 0000000..f59a7d2 --- /dev/null +++ b/localXHR.js @@ -0,0 +1,13 @@ +// makes Request compatible with requests on the file:// protocol + +if (location.protocol == 'file:') Request.implement({ + + setTransport: function(){ + this.transport = (window.ActiveXObject) ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest(); + }, + + isSuccess: function() { + return (!this.status || (this.status >= 200) && (this.status < 300)); + } + +}); \ No newline at end of file