Using $.ajax(url) when url is a file://
My code uses the $.ajax(url) call to fetch a url. It generally works, but breaks on IE if the url is a (local) file:// url rather than an
http:// url. The file:// url works just fine in firefox, but in IE the call does not succeed. Is the IE behavior a bug? If not, is there a proper jquery way to fetch a url that will work for both http: and file: urls, or do I need to implement the check to differentiate them myself? I'm enclosing the code that breaks (modulo choose-your-own-filename)
<html>
<head>
<script src="http://code.jquery.com/jquery-1.4.2.js" type="text/javascript"></script>
</head>
<body>
<script>
var file=null;
$.ajax({ url: "your filename here",
type: 'GET',
dataType: 'xml',
async: false,
success: function (data) { file = data; }
});
alert(file);
</script>
</body>