By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,776 Members | 1,302 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,776 IT Pros & Developers. It's quick & easy.

Reading a remote file or page?

P: n/a
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
Jan 17 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 17 '06 #2

P: n/a
Thank you Evertjan.

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jan 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.