[Javascript] Data Loading

Håkan Magnusson hakan at backbase.com
Mon Mar 8 09:21:52 CST 2004


It is, through ActiveX with IE and built in with Mozilla. If you can 
forgive my ugly browser check and the fact that Internet Explorer give 
you a security alert and Mozilla doesn't have permissions to open the 
URL (never done this cross-domain before, but my guess is it should be 
possible) this is a good example. Change the Google URL to a local file 
(no need to specifiy the file:// protocol, just set it to "myfile.html") 
to see it work in both browsers.

//----
var oRequest;

if(document.all) {
	// Internet Explorer
	oRequest = new ActiveXObject("Microsoft.XMLHTTP")
}
else {
	// Mozilla
	oRequest = new XMLHttpRequest();
}
oRequest.open("GET", "http://www.google.com/", false);
oRequest.send(null);

alert(oRequest.responseText);
//----


Regards,
H

Chris T wrote:

>>JavaScript XMLHttp-requests do not require a certain type of server, as
>>a matter of fact it perfectly supports getting files from the local
>>filesystem, and the support is quite rock solid in both IE5+ and Mozilla
>>browsers.
> 
> 
> I've never used this component in client-side code - didn't know it was
> available...
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 



More information about the Javascript mailing list