Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable loading local file using ajax in IE9

I know there is the origin problem, but setting up a web server is not an option here. Firefox v14 has no problem loading a local file. Chrome has no problem after adding '--allow-file-access-from-files' Is there any way to fix also IE9? Thank you


Edit: I figured out the solution. Just use ActiveXObject("MSXML2.XMLHTTP.6.0") instead of XMLHttpRequest() for IE9 to overcome the local file access deny problem.

like image 986
user1589188 Avatar asked Aug 10 '12 07:08

user1589188


People also ask

Does AJAX work with local files?

Note that you cannot make an AJAX request to the local file system from an external domain in either browser - it would be a massive security flaw if you could. For this AJAX request to work in Chrome you need to make the request to a webserver.

Which function is used to load a resource in the background in AJAX?

jQuery - AJAX load() Method The load() method loads data from a server and puts the returned data into the selected element. Syntax: $(selector). load(URL,data,callback);

How does Ajax work in real time?

How Does It Work? AJAX stands for Asynchronous JavaScript and XML. It is used for allowing the client side of an application to communitcate with the server side of the application. Before AJAX, there was no way for the client side of a web application to communicate directly with the server.


1 Answers

Ajax or not. HTTP is a client-server application protocol. Without a server, that's just not possible.

UPDATE:

Possible in chrome (and firefox) apparently. As for IE you can read up on Mark of the Web.

like image 184
Robin Maben Avatar answered Oct 21 '22 15:10

Robin Maben