Reading a remote file or page?

A

Adrian

Hi
I have some local pages (on PC harddisk) that act as a user interface
and a set of JS files that controls it all. I now want to be able to access
a remote web server to read a txt file and use the result in my local
script.

eg

Remote text file i.e. conf.txt

XYZ http:\\www.xyz.com\test?me=you

ABC http:\\www.abc.com\test

end

the file is to be opened and read from the remote server my interface would
then know when a user types XYZ <enter> to open
http:\\www.xyz.com\test?me=you within a frame.

so how do I open read and close a remote file say www.test.com/config.txt ?

thanks
 
E

Evertjan.

Adrian wrote on 17 jan 2006 in comp.lang.javascript:
I have some local pages (on PC harddisk) that act as a user interface
and a set of JS files that controls it all. I now want to be able to
access a remote web server to read a txt file and use the result in my
local script.

In IE:

function getUrl(url) {
var http = new ActiveXObject("microsoft.xmlhttp");
http.open("GET",url,false);
http.send();
return http.responseText;
}

theFile = getUrl('http://myServer.com/myFile.txt')

===============

You will need to change the IE security settings in
options->advanced->"Allow active content..my computer",
I seem to remember.
 
A

Adrian

Thank you Evertjan.

Evertjan. said:
Adrian wrote on 17 jan 2006 in comp.lang.javascript:


In IE:

function getUrl(url) {
var http = new ActiveXObject("microsoft.xmlhttp");
http.open("GET",url,false);
http.send();
return http.responseText;
}

theFile = getUrl('http://myServer.com/myFile.txt')

===============

You will need to change the IE security settings in
options->advanced->"Allow active content..my computer",
I seem to remember.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top