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

Can I use a temp file with client-side JavaScript?

P: n/a
Don
I'm writing an html page with some JavaScript that reads a web page
into a client-side temp file, then reformats it, then submits that
same file as a URL to the browser for display, via "locate.replace".

I can do all this if the html page containing the script originates
on the client machine, but don't know how to get access to a
client-side temp file when the same html page containing the script is
on a web host. How do I get access to a client-side temp file?

or

Is there some way I can use an array instead of a file to achieve the
same thing? If so, how do I submit the array as a URL for the browser
to display?

Thanks,
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #1
Share this Question
Share on Google+
26 Replies


P: n/a
"Don" <no@adr.com> wrote in message
news:4v********************************@4ax.com...
I'm writing an html page with some JavaScript that reads a web page
into a client-side temp file, then reformats it, then submits that
same file as a URL to the browser for display, via "locate.replace".

I can do all this if the html page containing the script originates
on the client machine, but don't know how to get access to a
client-side temp file when the same html page containing the script is
on a web host. How do I get access to a client-side temp file?

or

Is there some way I can use an array instead of a file to achieve the
same thing? If so, how do I submit the array as a URL for the browser
to display?

Thanks,
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Access to the client's file system (via FSO) raises an ActiveX security
warning.

You can use JavaScript to construct a Web page then use window.open().

For example; watch for word-wrap.

<html>
<head>
<title>myPage.htm</title>
<script type="text/javascript">
function myPage() {
var html = "<html><head><title>My Page</title></head>";
html += "<body>Hello World</body></html>";
var wind = window.open();
wind.document.write(html);
}
</script>
</head>
<body onload="myPage()">
</body>
</html>

window.open can accept parameters for greater control.
Jul 23 '05 #2

P: n/a
Don
McKirahan,

I just tried this and it works great. Thank you very much. I
appreciate you taking the time with this.

Regards, Don
On Wed, 15 Sep 2004 10:21:23 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:4v********************************@4ax.com.. .
I'm writing an html page with some JavaScript that reads a web page
into a client-side temp file, then reformats it, then submits that
same file as a URL to the browser for display, via "locate.replace".

I can do all this if the html page containing the script originates
on the client machine, but don't know how to get access to a
client-side temp file when the same html page containing the script is
on a web host. How do I get access to a client-side temp file?

or

Is there some way I can use an array instead of a file to achieve the
same thing? If so, how do I submit the array as a URL for the browser
to display?

Thanks,
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Access to the client's file system (via FSO) raises an ActiveX security
warning.

You can use JavaScript to construct a Web page then use window.open().

For example; watch for word-wrap.

<html>
<head>
<title>myPage.htm</title>
<script type="text/javascript">
function myPage() {
var html = "<html><head><title>My Page</title></head>";
html += "<body>Hello World</body></html>";
var wind = window.open();
wind.document.write(html);
}
</script>
</head>
<body onload="myPage()">
</body>
</html>

window.open can accept parameters for greater control.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #3

P: n/a
Don
Hi McKirahan,

Well, I'm making progress, but have a little problem with the
following embedded script. It's supposed to read the body of a page
into an array, then open a window on which it is then displayed. I
have some debug "alert" statements embedded, and find the page body
(strPageBody) is null after being read from the web site. I've tried
just about everything I can think of. If I replace the "strPageBody =
xmlhttp.responseBody" statement with one that just fills strPageBody
with a char string it works. Any ideas?

Thanks again, Don
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
//
var strPageURL = [];
var strPageBody = [];
//
// Get page
//
strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
get_page (strPageURL);
//
// Display page
//
alert ("Body just before display: "+strPageBody);
var wind = window.open();
wind.document.write(strPageBody);
//
//
function get_page(strPageURL)
{
var userName;
var password;
//
alert ("URL at start of function: "+strPageURL);
alert ("Body at start of function: "+strPageBody);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",strPageURL,false);
xmlhttp.send();
strPageBody = xmlhttp.responseBody;
alert ("Body at end of function: "+strPageBody);
}
//-->
</script>
</body>
</html>


On Wed, 15 Sep 2004 10:21:23 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:4v********************************@4ax.com.. .
I'm writing an html page with some JavaScript that reads a web page
into a client-side temp file, then reformats it, then submits that
same file as a URL to the browser for display, via "locate.replace".

I can do all this if the html page containing the script originates
on the client machine, but don't know how to get access to a
client-side temp file when the same html page containing the script is
on a web host. How do I get access to a client-side temp file?

or

Is there some way I can use an array instead of a file to achieve the
same thing? If so, how do I submit the array as a URL for the browser
to display?

Thanks,
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Access to the client's file system (via FSO) raises an ActiveX security
warning.

You can use JavaScript to construct a Web page then use window.open().

For example; watch for word-wrap.

<html>
<head>
<title>myPage.htm</title>
<script type="text/javascript">
function myPage() {
var html = "<html><head><title>My Page</title></head>";
html += "<body>Hello World</body></html>";
var wind = window.open();
wind.document.write(html);
}
</script>
</head>
<body onload="myPage()">
</body>
</html>

window.open can accept parameters for greater control.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #4

P: n/a
"Don" <no@adr.com> wrote in message
news:jc********************************@4ax.com...
Hi McKirahan,

Well, I'm making progress, but have a little problem with the
following embedded script. It's supposed to read the body of a page
into an array, then open a window on which it is then displayed. I
have some debug "alert" statements embedded, and find the page body
(strPageBody) is null after being read from the web site. I've tried
just about everything I can think of. If I replace the "strPageBody =
xmlhttp.responseBody" statement with one that just fills strPageBody
with a char string it works. Any ideas?

Thanks again, Don
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
//
var strPageURL = [];
var strPageBody = [];
//
// Get page
//
strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
get_page (strPageURL);
//
// Display page
//
alert ("Body just before display: "+strPageBody);
var wind = window.open();
wind.document.write(strPageBody);
//
//
function get_page(strPageURL)
{
var userName;
var password;
//
alert ("URL at start of function: "+strPageURL);
alert ("Body at start of function: "+strPageBody);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",strPageURL,false);
xmlhttp.send();
strPageBody = xmlhttp.responseBody;
alert ("Body at end of function: "+strPageBody);
}
//-->
</script>
</body>
</html>


On Wed, 15 Sep 2004 10:21:23 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:4v********************************@4ax.com.. .
I'm writing an html page with some JavaScript that reads a web page
into a client-side temp file, then reformats it, then submits that
same file as a URL to the browser for display, via "locate.replace".

I can do all this if the html page containing the script originates
on the client machine, but don't know how to get access to a
client-side temp file when the same html page containing the script is
on a web host. How do I get access to a client-side temp file?

or

Is there some way I can use an array instead of a file to achieve the
same thing? If so, how do I submit the array as a URL for the browser
to display?

Thanks,
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Access to the client's file system (via FSO) raises an ActiveX security
warning.

You can use JavaScript to construct a Web page then use window.open().

For example; watch for word-wrap.

<html>
<head>
<title>myPage.htm</title>
<script type="text/javascript">
function myPage() {
var html = "<html><head><title>My Page</title></head>";
html += "<body>Hello World</body></html>";
var wind = window.open();
wind.document.write(html);
}
</script>
</head>
<body onload="myPage()">
</body>
</html>

window.open can accept parameters for greater control.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Here's one approach; watch for word-wrap.

<html>
<head>
<title>TestPage.htm</title>
</head>
<body>
<script type="text/javascript">
var sURL = "http://silvereaglenest.com/htmltestpage.htm";
var sHTM = get_page(sURL);
alert(sHTM);
var wind = window.open();
wind.document.write(sHTM);

function get_page(URL) {
var sTMP = "C:\\temp\\TestPage.tmp";
var oXML = new ActiveXObject("Microsoft.XMLHTTP");
oXML.Open("Get",URL,false);
oXML.send();
var sXML = oXML.responseBody;
var oADO = new ActiveXObject("ADODB.Stream");
oADO.Mode = 3;
oADO.Type = 1;
oADO.Open;
oADO.Write(sXML);
oADO.SaveToFile(sTMP,2);
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
var oOTF = oFSO.OpenTextFile(sTMP,1);
var sOTF = oOTF.ReadAll();
oOTF.Close();
oFSO.DeleteFile(sTMP);
return sOTF;
}
</script>
</body>
</html>
Jul 23 '05 #5

P: n/a
Don
On Thu, 16 Sep 2004 14:42:29 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:jc********************************@4ax.com.. .
Hi McKirahan,

Well, I'm making progress, but have a little problem with the
following embedded script. It's supposed to read the body of a page
into an array, then open a window on which it is then displayed. I
have some debug "alert" statements embedded, and find the page body
(strPageBody) is null after being read from the web site. I've tried
just about everything I can think of. If I replace the "strPageBody =
xmlhttp.responseBody" statement with one that just fills strPageBody
with a char string it works. Any ideas?

Thanks again, Don
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
//
var strPageURL = [];
var strPageBody = [];
//
// Get page
//
strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
get_page (strPageURL);
//
// Display page
//
alert ("Body just before display: "+strPageBody);
var wind = window.open();
wind.document.write(strPageBody);
//
//
function get_page(strPageURL)
{
var userName;
var password;
//
alert ("URL at start of function: "+strPageURL);
alert ("Body at start of function: "+strPageBody);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",strPageURL,false);
xmlhttp.send();
strPageBody = xmlhttp.responseBody;
alert ("Body at end of function: "+strPageBody);
}
//-->
</script>
</body>
</html>


On Wed, 15 Sep 2004 10:21:23 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
>"Don" <no@adr.com> wrote in message
>news:4v********************************@4ax.com.. .
>> I'm writing an html page with some JavaScript that reads a web page
>> into a client-side temp file, then reformats it, then submits that
>> same file as a URL to the browser for display, via "locate.replace".
>>
>> I can do all this if the html page containing the script originates
>> on the client machine, but don't know how to get access to a
>> client-side temp file when the same html page containing the script is
>> on a web host. How do I get access to a client-side temp file?
>>
>> or
>>
>> Is there some way I can use an array instead of a file to achieve the
>> same thing? If so, how do I submit the array as a URL for the browser
>> to display?
>>
>> Thanks,
>> Don
>>
>>
>> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
>> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
>> -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
>
>Access to the client's file system (via FSO) raises an ActiveX security
>warning.
>
>You can use JavaScript to construct a Web page then use window.open().
>
>For example; watch for word-wrap.
>
><html>
><head>
><title>myPage.htm</title>
><script type="text/javascript">
>function myPage() {
> var html = "<html><head><title>My Page</title></head>";
> html += "<body>Hello World</body></html>";
> var wind = window.open();
> wind.document.write(html);
>}
></script>
></head>
><body onload="myPage()">
></body>
></html>
>
>window.open can accept parameters for greater control.
>


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Here's one approach; watch for word-wrap.

<html>
<head>
<title>TestPage.htm</title>
</head>
<body>
<script type="text/javascript">
var sURL = "http://silvereaglenest.com/htmltestpage.htm";
var sHTM = get_page(sURL);
alert(sHTM);
var wind = window.open();
wind.document.write(sHTM);

function get_page(URL) {
var sTMP = "C:\\temp\\TestPage.tmp";
var oXML = new ActiveXObject("Microsoft.XMLHTTP");
oXML.Open("Get",URL,false);
oXML.send();
var sXML = oXML.responseBody;
var oADO = new ActiveXObject("ADODB.Stream");
oADO.Mode = 3;
oADO.Type = 1;
oADO.Open;
oADO.Write(sXML);
oADO.SaveToFile(sTMP,2);
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
var oOTF = oFSO.OpenTextFile(sTMP,1);
var sOTF = oOTF.ReadAll();
oOTF.Close();
oFSO.DeleteFile(sTMP);
return sOTF;
}
</script>
</body>
</html>


I tried the preceeding and get an "Error: Write to File Failed" on
"oADO.SaveToFile(sTMP,2)". Also, I thought you said I couldn't access
client-side files since this page will be downloaded from a host, and
that's why we were trying use of an array, as in my previous example.

Thanks, don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #6

P: n/a
Lee
Don said:

Well, I'm making progress, but have a little problem with the
following embedded script. It's supposed to read the body of a page
into an array, then open a window on which it is then displayed. I
have some debug "alert" statements embedded, and find the page body
(strPageBody) is null after being read from the web site.
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
Get rid of that comment and it's mate. They're not needed, anymore.

//
var strPageURL = [];
var strPageBody = [];
Here, you're declaring these variables as local arrays.
Later you assign a string (not array) value to strPageURL,
but you never assign any value to the local strPageBody.
In the function get_page(), you assign a string value to an
entirely different global variable with the same name.

The simplest fix is to simply remove the line declaring
strPageBody to be a local array. That way, only the global
variable (containing a string) will exist, and that turns out
to be what you want, in this case.

//
// Get page
//
strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
get_page (strPageURL);
//
// Display page
//
alert ("Body just before display: "+strPageBody);
var wind = window.open();
wind.document.write(strPageBody);
It's not safe to try to write into a window that you've just
opened. The operating system may not have actually opened
the new window, yet, at the time that you try to access its
document. Use:

window.open("javascript:opener.strPageBody");

That will allow the new window to reach back into the current
window and load the value of the *global* strPageBody variable
as its content.

//
//
function get_page(strPageURL)
{
var userName;
var password;
//
alert ("URL at start of function: "+strPageURL);
alert ("Body at start of function: "+strPageBody);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",strPageURL,false);
xmlhttp.send();
strPageBody = xmlhttp.responseBody;
alert ("Body at end of function: "+strPageBody);
}
//-->
</script>
</body>
</html>


Jul 23 '05 #7

P: n/a
Don
On Thu, 16 Sep 2004 08:11:26 -0700, Don <no@adr.com> wrote:
On Thu, 16 Sep 2004 14:42:29 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:jc********************************@4ax.com. ..
Hi McKirahan,

Well, I'm making progress, but have a little problem with the
following embedded script. It's supposed to read the body of a page
into an array, then open a window on which it is then displayed. I
have some debug "alert" statements embedded, and find the page body
(strPageBody) is null after being read from the web site. I've tried
just about everything I can think of. If I replace the "strPageBody =
xmlhttp.responseBody" statement with one that just fills strPageBody
with a char string it works. Any ideas?

Thanks again, Don
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
//
var strPageURL = [];
var strPageBody = [];
//
// Get page
//
strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
get_page (strPageURL);
//
// Display page
//
alert ("Body just before display: "+strPageBody);
var wind = window.open();
wind.document.write(strPageBody);
//
//
function get_page(strPageURL)
{
var userName;
var password;
//
alert ("URL at start of function: "+strPageURL);
alert ("Body at start of function: "+strPageBody);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",strPageURL,false);
xmlhttp.send();
strPageBody = xmlhttp.responseBody;
alert ("Body at end of function: "+strPageBody);
}
//-->
</script>
</body>
</html>


On Wed, 15 Sep 2004 10:21:23 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:

>"Don" <no@adr.com> wrote in message
>news:4v********************************@4ax.com.. .
>> I'm writing an html page with some JavaScript that reads a web page
>> into a client-side temp file, then reformats it, then submits that
>> same file as a URL to the browser for display, via "locate.replace".
>>
>> I can do all this if the html page containing the script originates
>> on the client machine, but don't know how to get access to a
>> client-side temp file when the same html page containing the script is
>> on a web host. How do I get access to a client-side temp file?
>>
>> or
>>
>> Is there some way I can use an array instead of a file to achieve the
>> same thing? If so, how do I submit the array as a URL for the browser
>> to display?
>>
>> Thanks,
>> Don
>>
>>
>> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
>> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
>> -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
>
>Access to the client's file system (via FSO) raises an ActiveX security
>warning.
>
>You can use JavaScript to construct a Web page then use window.open().
>
>For example; watch for word-wrap.
>
><html>
><head>
><title>myPage.htm</title>
><script type="text/javascript">
>function myPage() {
> var html = "<html><head><title>My Page</title></head>";
> html += "<body>Hello World</body></html>";
> var wind = window.open();
> wind.document.write(html);
>}
></script>
></head>
><body onload="myPage()">
></body>
></html>
>
>window.open can accept parameters for greater control.
>

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Here's one approach; watch for word-wrap.

<html>
<head>
<title>TestPage.htm</title>
</head>
<body>
<script type="text/javascript">
var sURL = "http://silvereaglenest.com/htmltestpage.htm";
var sHTM = get_page(sURL);
alert(sHTM);
var wind = window.open();
wind.document.write(sHTM);

function get_page(URL) {
var sTMP = "C:\\temp\\TestPage.tmp";
var oXML = new ActiveXObject("Microsoft.XMLHTTP");
oXML.Open("Get",URL,false);
oXML.send();
var sXML = oXML.responseBody;
var oADO = new ActiveXObject("ADODB.Stream");
oADO.Mode = 3;
oADO.Type = 1;
oADO.Open;
oADO.Write(sXML);
oADO.SaveToFile(sTMP,2);
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
var oOTF = oFSO.OpenTextFile(sTMP,1);
var sOTF = oOTF.ReadAll();
oOTF.Close();
oFSO.DeleteFile(sTMP);
return sOTF;
}
</script>
</body>
</html>


I tried the preceeding and get an "Error: Write to File Failed" on
"oADO.SaveToFile(sTMP,2)". Also, I thought you said I couldn't access
client-side files since this page will be downloaded from a host, and
that's why we were trying use of an array, as in my previous example.

Thanks, don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


OOPS! I forgot to make sure I had a Temp folder at "C:"
The foregoing works when the page is launched from my desktop, but not
when run from my host, which is where I want to run it. Aren't I
going to have to do this with an array, since file access isn't
allowed from pages running from a host? If so, any idea why our array
approach above didn't work?

Thanks, Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #8

P: n/a
Don
On Thu, 16 Sep 2004 14:42:29 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:jc********************************@4ax.com.. .
Hi McKirahan,

Well, I'm making progress, but have a little problem with the
following embedded script. It's supposed to read the body of a page
into an array, then open a window on which it is then displayed. I
have some debug "alert" statements embedded, and find the page body
(strPageBody) is null after being read from the web site. I've tried
just about everything I can think of. If I replace the "strPageBody =
xmlhttp.responseBody" statement with one that just fills strPageBody
with a char string it works. Any ideas?

Thanks again, Don
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
//
var strPageURL = [];
var strPageBody = [];
//
// Get page
//
strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
get_page (strPageURL);
//
// Display page
//
alert ("Body just before display: "+strPageBody);
var wind = window.open();
wind.document.write(strPageBody);
//
//
function get_page(strPageURL)
{
var userName;
var password;
//
alert ("URL at start of function: "+strPageURL);
alert ("Body at start of function: "+strPageBody);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",strPageURL,false);
xmlhttp.send();
strPageBody = xmlhttp.responseBody;
alert ("Body at end of function: "+strPageBody);
}
//-->
</script>
</body>
</html>


On Wed, 15 Sep 2004 10:21:23 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
>"Don" <no@adr.com> wrote in message
>news:4v********************************@4ax.com.. .
>> I'm writing an html page with some JavaScript that reads a web page
>> into a client-side temp file, then reformats it, then submits that
>> same file as a URL to the browser for display, via "locate.replace".
>>
>> I can do all this if the html page containing the script originates
>> on the client machine, but don't know how to get access to a
>> client-side temp file when the same html page containing the script is
>> on a web host. How do I get access to a client-side temp file?
>>
>> or
>>
>> Is there some way I can use an array instead of a file to achieve the
>> same thing? If so, how do I submit the array as a URL for the browser
>> to display?
>>
>> Thanks,
>> Don
>>
>>
>> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
>> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
>> -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
>
>Access to the client's file system (via FSO) raises an ActiveX security
>warning.
>
>You can use JavaScript to construct a Web page then use window.open().
>
>For example; watch for word-wrap.
>
><html>
><head>
><title>myPage.htm</title>
><script type="text/javascript">
>function myPage() {
> var html = "<html><head><title>My Page</title></head>";
> html += "<body>Hello World</body></html>";
> var wind = window.open();
> wind.document.write(html);
>}
></script>
></head>
><body onload="myPage()">
></body>
></html>
>
>window.open can accept parameters for greater control.
>


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Here's one approach; watch for word-wrap.

<html>
<head>
<title>TestPage.htm</title>
</head>
<body>
<script type="text/javascript">
var sURL = "http://silvereaglenest.com/htmltestpage.htm";
var sHTM = get_page(sURL);
alert(sHTM);
var wind = window.open();
wind.document.write(sHTM);

function get_page(URL) {
var sTMP = "C:\\temp\\TestPage.tmp";
var oXML = new ActiveXObject("Microsoft.XMLHTTP");
oXML.Open("Get",URL,false);
oXML.send();
var sXML = oXML.responseBody;
var oADO = new ActiveXObject("ADODB.Stream");
oADO.Mode = 3;
oADO.Type = 1;
oADO.Open;
oADO.Write(sXML);
oADO.SaveToFile(sTMP,2);
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
var oOTF = oFSO.OpenTextFile(sTMP,1);
var sOTF = oOTF.ReadAll();
oOTF.Close();
oFSO.DeleteFile(sTMP);
return sOTF;
}
</script>
</body>
</html>


OOPS! I forgot to make sure I had a Temp folder at "C:"
The foregoing works when the page is launched from my desktop, but not
when run from my host, which is where I want to run it. Aren't I
going to have to do this with an array, since file access isn't
allowed from pages running from a host? If so, any idea why our array
approach above didn't work?

Thanks, Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #9

P: n/a
[snip]
OOPS! I forgot to make sure I had a Temp folder at "C:"
The foregoing works when the page is launched from my desktop, but not
when run from my host, which is where I want to run it. Aren't I
going to have to do this with an array, since file access isn't
allowed from pages running from a host? If so, any idea why our array
approach above didn't work?

Thanks, Don


I'm not doing a very good job of understanding your task.

Initially, I showed you how to open a window which answered one of your
questions:
"how do I submit the array as a URL for the browser to display?"

Subsequently, I showed you how to get the page source captured via XMLHTTP
which addressed the issue of "I ... find the page body (strPageBody) is
null".

Anyway, could you describe your task in more discreet steps? Thanks.
Jul 23 '05 #10

P: n/a
Don
On Thu, 16 Sep 2004 17:15:19 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
[snip]
OOPS! I forgot to make sure I had a Temp folder at "C:"
The foregoing works when the page is launched from my desktop, but not
when run from my host, which is where I want to run it. Aren't I
going to have to do this with an array, since file access isn't
allowed from pages running from a host? If so, any idea why our array
approach above didn't work?

Thanks, Don


I'm not doing a very good job of understanding your task.

Initially, I showed you how to open a window which answered one of your
questions:
"how do I submit the array as a URL for the browser to display?"

Subsequently, I showed you how to get the page source captured via XMLHTTP
which addressed the issue of "I ... find the page body (strPageBody) is
null".

Anyway, could you describe your task in more discreet steps? Thanks.


I'm sorry I haven't been clear enough on what I'm trying to do.
Here's an outline:
- page will run on client's machine from host
- page does the following:
- reads a specific web page
- modifies that page (none of my code presented to you has
addressed this step yet.)
- then presents the modified page to the client in the same browser
window opened by this page in the first place.

I hope this is clearer.
Thanks for your help.
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #11

P: n/a
[snip]
I'm sorry I haven't been clear enough on what I'm trying to do.
Here's an outline:
- page will run on client's machine from host
- page does the following:
- reads a specific web page
- modifies that page (none of my code presented to you has
addressed this step yet.)
- then presents the modified page to the client in the same browser
window opened by this page in the first place.

I hope this is clearer.
Thanks for your help.
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Can you describe an example of this? Thanks.
Jul 23 '05 #12

P: n/a
Don
On Thu, 16 Sep 2004 18:59:57 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
[snip]
I'm sorry I haven't been clear enough on what I'm trying to do.
Here's an outline:
- page will run on client's machine from host
- page does the following:
- reads a specific web page
- modifies that page (none of my code presented to you has
addressed this step yet.)
- then presents the modified page to the client in the same browser
window opened by this page in the first place.

I hope this is clearer.
Thanks for your help.
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Can you describe an example of this? Thanks.

I'm not sure I've seen something like this before. What I'm trying to
do is provide a better presentation of an exsisting aviation chat
group message page, including a way to attach images. The existing
chat message page is very primitive. On my modified page I will have
a form allowing the client to add images before he clicks to post the
message. My script will copy the images to my host server, where a
PHP script will store it on the server. This client-side script I am
trying to write will also build in the html code to reference the
images. Then it will actually post it just as normal chat messages
are posted.

In the client-side script you are helping me with, I just need to get
past the point where I can read the chat index page, and be able to
display it in the same browser window the script itself is running in.
Note, the script we are working with doesn't actually reference the
chat page, but instead contains just test data.

Does this help?
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #13

P: n/a
Don
On Thu, 16 Sep 2004 12:18:46 -0700, Don <no@adr.com> wrote:
On Thu, 16 Sep 2004 18:59:57 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
[snip]
I'm sorry I haven't been clear enough on what I'm trying to do.
Here's an outline:
- page will run on client's machine from host
- page does the following:
- reads a specific web page
- modifies that page (none of my code presented to you has
addressed this step yet.)
- then presents the modified page to the client in the same browser
window opened by this page in the first place.

I hope this is clearer.
Thanks for your help.
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Can you describe an example of this? Thanks.

I'm not sure I've seen something like this before. What I'm trying to
do is provide a better presentation of an exsisting aviation chat
group message page, including a way to attach images. The existing
chat message page is very primitive. On my modified page I will have
a form allowing the client to add images before he clicks to post the
message. My script will copy the images to my host server, where a
PHP script will store it on the server. This client-side script I am
trying to write will also build in the html code to reference the
images. Then it will actually post it just as normal chat messages
are posted.

In the client-side script you are helping me with, I just need to get
past the point where I can read the chat index page, and be able to
display it in the same browser window the script itself is running in.
Note, the script we are working with doesn't actually reference the
chat page, but instead contains just test data.

Does this help?
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


I just don't understand why "strPageBody" in the script below was null
after the read. If I could only get this script working, I think I'd
have the battle won.
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
//
var strPageURL = [];
var strPageBody = [];
//
// Get page
//
strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
get_page (strPageURL);
//
// Display page
//
alert ("Body just before display: "+strPageBody);
var wind = window.open();
wind.document.write(strPageBody);
//
//
function get_page(strPageURL)
{
var userName;
var password;
//
alert ("URL at start of function: "+strPageURL);
alert ("Body at start of function: "+strPageBody);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",strPageURL,false);
xmlhttp.send();
strPageBody = xmlhttp.responseBody;
alert ("Body at end of function: "+strPageBody);
}
//-->
</script>
</body>
</html>

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #14

P: n/a
"Don" <no@adr.com> wrote in message
news:fq********************************@4ax.com...
On Thu, 16 Sep 2004 12:18:46 -0700, Don <no@adr.com> wrote:
On Thu, 16 Sep 2004 18:59:57 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
[snip]

I'm sorry I haven't been clear enough on what I'm trying to do.
Here's an outline:
- page will run on client's machine from host
- page does the following:
- reads a specific web page
- modifies that page (none of my code presented to you has
addressed this step yet.)
- then presents the modified page to the client in the same browser
window opened by this page in the first place.

I hope this is clearer.
Thanks for your help.
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Can you describe an example of this? Thanks.

I'm not sure I've seen something like this before. What I'm trying to
do is provide a better presentation of an exsisting aviation chat
group message page, including a way to attach images. The existing
chat message page is very primitive. On my modified page I will have
a form allowing the client to add images before he clicks to post the
message. My script will copy the images to my host server, where a
PHP script will store it on the server. This client-side script I am
trying to write will also build in the html code to reference the
images. Then it will actually post it just as normal chat messages
are posted.

In the client-side script you are helping me with, I just need to get
past the point where I can read the chat index page, and be able to
display it in the same browser window the script itself is running in.
Note, the script we are working with doesn't actually reference the
chat page, but instead contains just test data.

Does this help?
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


I just don't understand why "strPageBody" in the script below was null
after the read. If I could only get this script working, I think I'd
have the battle won.
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
//
var strPageURL = [];
var strPageBody = [];
//
// Get page
//
strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
get_page (strPageURL);
//
// Display page
//
alert ("Body just before display: "+strPageBody);
var wind = window.open();
wind.document.write(strPageBody);
//
//
function get_page(strPageURL)
{
var userName;
var password;
//
alert ("URL at start of function: "+strPageURL);
alert ("Body at start of function: "+strPageBody);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",strPageURL,false);
xmlhttp.send();
strPageBody = xmlhttp.responseBody;
alert ("Body at end of function: "+strPageBody);
}
//-->
</script>
</body>
</html>

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Change ".responseBody" to ".responseText".
Save the following as "test.js" then double-click on it.

var sURL = "http://www.Google.com/index.html";
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
xmlhttp.open("GET", sURL, false);
xmlhttp.send();
WScript.Echo(xmlhttp.responseBody);
WScript.Echo(xmlhttp.responseText);
Take a look at this link:

http://msdn.microsoft.com/library/de...us/xmlsdk/html
/xmproresponsebodyixmlhttprequest.asp

Under "Remarks" (for ResponseBody) it states:

"This contains the raw undecoded bytes as received directly from the
server."
Jul 23 '05 #15

P: n/a
Don
On Thu, 16 Sep 2004 20:03:50 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:fq********************************@4ax.com.. .
On Thu, 16 Sep 2004 12:18:46 -0700, Don <no@adr.com> wrote:
>On Thu, 16 Sep 2004 18:59:57 GMT, "McKirahan" <Ne**@McKirahan.com>
>wrote:
>
>>[snip]
>>
>>> I'm sorry I haven't been clear enough on what I'm trying to do.
>>> Here's an outline:
>>> - page will run on client's machine from host
>>> - page does the following:
>>> - reads a specific web page
>>> - modifies that page (none of my code presented to you has
>>> addressed this step yet.)
>>> - then presents the modified page to the client in the same browser
>>> window opened by this page in the first place.
>>>
>>> I hope this is clearer.
>>> Thanks for your help.
>>> Don
>>>
>>>
>>> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
>>> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
>>> -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
>>
>>Can you describe an example of this? Thanks.
>>
>I'm not sure I've seen something like this before. What I'm trying to
>do is provide a better presentation of an exsisting aviation chat
>group message page, including a way to attach images. The existing
>chat message page is very primitive. On my modified page I will have
>a form allowing the client to add images before he clicks to post the
>message. My script will copy the images to my host server, where a
>PHP script will store it on the server. This client-side script I am
>trying to write will also build in the html code to reference the
>images. Then it will actually post it just as normal chat messages
>are posted.
>
>In the client-side script you are helping me with, I just need to get
>past the point where I can read the chat index page, and be able to
>display it in the same browser window the script itself is running in.
>Note, the script we are working with doesn't actually reference the
>chat page, but instead contains just test data.
>
>Does this help?
>Don
>
>
>-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
>http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
>-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


I just don't understand why "strPageBody" in the script below was null
after the read. If I could only get this script working, I think I'd
have the battle won.
>>> <html>
>>> <head>
>>> <title>Test</title>
>>> <meta http-equiv="Content-Type" content="text/html;
>>> charset=iso-8859-1">
>>> </head>
>>> <body>
>>> <script language="JavaScript" type="text/javascript">
>>> <!--
>>> //
>>> var strPageURL = [];
>>> var strPageBody = [];
>>> //
>>> // Get page
>>> //
>>> strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
>>> get_page (strPageURL);
>>> //
>>> // Display page
>>> //
>>> alert ("Body just before display: "+strPageBody);
>>> var wind = window.open();
>>> wind.document.write(strPageBody);
>>> //
>>> //
>>> function get_page(strPageURL)
>>> {
>>> var userName;
>>> var password;
>>> //
>>> alert ("URL at start of function: "+strPageURL);
>>> alert ("Body at start of function: "+strPageBody);
>>> var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
>>> xmlhttp.Open("Get",strPageURL,false);
>>> xmlhttp.send();
>>> strPageBody = xmlhttp.responseBody;
>>> alert ("Body at end of function: "+strPageBody);
>>> }
>>> //-->
>>> </script>
>>> </body>
>>> </html>

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Change ".responseBody" to ".responseText".
Save the following as "test.js" then double-click on it.

var sURL = "http://www.Google.com/index.html";
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
xmlhttp.open("GET", sURL, false);
xmlhttp.send();
WScript.Echo(xmlhttp.responseBody);
WScript.Echo(xmlhttp.responseText);
Take a look at this link:

http://msdn.microsoft.com/library/de...us/xmlsdk/html
/xmproresponsebodyixmlhttprequest.asp

Under "Remarks" (for ResponseBody) it states:

"This contains the raw undecoded bytes as received directly from the
server."

That's it, you've got it! I changed it in the following script, and
it works just great now. THANK YOU! THANK YOU!

I was hoping to have the display occur on the same browser window that
this page runs under, so the client can utilize the "back" button if
he wants. Any idea how to do that?

Thanks much for all your help. Sure nice to have these newsgroups.
Don't know what I'd do without them.

Don
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
//
//
var strPageURL = [];
var strPageBody = [];
//
// Get page
//
strPageURL = "http://silvereaglenest.com/htmltestpage.htm/";
get_page (strPageURL);
//
// Display page
//
alert ("Body just before display: "+strPageBody);
var wind = window.open();
wind.document.write(strPageBody);
//
//
//
function get_page(strPageURL)
{
var userName;
var password;
//
// Get page
//
alert ("URL at start of function: "+strPageURL);
alert ("Body at start of function: "+strPageBody);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",strPageURL,false);
xmlhttp.send();
strPageBody = xmlhttp.responseText;
alert ("Body at end of function: "+strPageBody);
}
//-->
</script>
</body>
</html>


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #16

P: n/a
"Don" <no@adr.com> wrote in message
news:lb********************************@4ax.com...
On Thu, 16 Sep 2004 20:03:50 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
[snip]
That's it, you've got it! I changed it in the following script, and
it works just great now. THANK YOU! THANK YOU!

I was hoping to have the display occur on the same browser window that
this page runs under, so the client can utilize the "back" button if
he wants. Any idea how to do that?

Thanks much for all your help. Sure nice to have these newsgroups.
Don't know what I'd do without them.

Don


To have the back button enabled write something to the current page then
have the script do a "document.write()" instead of "wind.document.write()".

Try the following "as-is"; watch for word-wrap.

<html>
<head>
<title>Test</title>
<script type="text/javascript">
var strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
function get_page(URL) {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",URL,false);
xmlhttp.send();
return xmlhttp.responseText;
}
function put_page() {
var strPageBody = get_page(strPageURL);
alert(strPageBody);
document.write(strPageBody);
}
</script>
</head>
<body>
<a href="javascript:put_page()">Click Me!</a>
</body>
</html>
May I point out the foillowing about your code:

1) you don't need:

language="JavaScript"
<!--
// -->

2) When you use a function() you "return" a value not set a global
variable from within it.

3) Similarly, the function's parameter diesn't have to be a global
variable.

4) Why are you doing this? (See my code above.)

var strPageURL = [];
var strPageBody = [];

5) Why are these declared? They're not used:

var userName;
var password;

6) Omit the trailing "/" from "strPageURL" as it causes a 404 error.

7) Use indentation under <script> for readability.
Jul 23 '05 #17

P: n/a
Don
On Thu, 16 Sep 2004 13:29:31 -0700, Don <no@adr.com> wrote:

Well, when I execute the script from the host, I get an "Error:
Permission Denied" on the following statement "var xmlhttp = new
ActiveXObject("Microsoft.XMLHTTP")". Looks like my desktop doesn't
want to execut an ActiveXObject from a page originating elsewhere. I
have my browser's security setting on Medium.

Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #18

P: n/a
"Don" <no@adr.com> wrote in message
news:mp********************************@4ax.com...
On Thu, 16 Sep 2004 13:29:31 -0700, Don <no@adr.com> wrote:

Well, when I execute the script from the host, I get an "Error:
Permission Denied" on the following statement "var xmlhttp = new
ActiveXObject("Microsoft.XMLHTTP")". Looks like my desktop doesn't
want to execut an ActiveXObject from a page originating elsewhere. I
have my browser's security setting on Medium.

Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Instead of
Microsoft.XMLHTTP
try
MSXML2.XMLHTTP
or
MSXML2.ServerXMLHTTP
or
MSXML2.XMLHTTP.3.0
Jul 23 '05 #19

P: n/a
Don
On Thu, 16 Sep 2004 21:47:45 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:mp********************************@4ax.com.. .
On Thu, 16 Sep 2004 13:29:31 -0700, Don <no@adr.com> wrote:

Well, when I execute the script from the host, I get an "Error:
Permission Denied" on the following statement "var xmlhttp = new
ActiveXObject("Microsoft.XMLHTTP")". Looks like my desktop doesn't
want to execut an ActiveXObject from a page originating elsewhere. I
have my browser's security setting on Medium.

Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Instead of
Microsoft.XMLHTTP
try
MSXML2.XMLHTTP
or
MSXML2.ServerXMLHTTP
or
MSXML2.XMLHTTP.3.0

Tried them. None of them work. Same error msg, except for
"MSXML2.ServerXMLHTTP" which produces "Error: Object doesn't support
this property or method"

Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #20

P: n/a
"Don" <no@adr.com> wrote in message
news:8u********************************@4ax.com...
On Thu, 16 Sep 2004 21:47:45 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:mp********************************@4ax.com.. .
On Thu, 16 Sep 2004 13:29:31 -0700, Don <no@adr.com> wrote:

Well, when I execute the script from the host, I get an "Error:
Permission Denied" on the following statement "var xmlhttp = new
ActiveXObject("Microsoft.XMLHTTP")". Looks like my desktop doesn't
want to execut an ActiveXObject from a page originating elsewhere. I
have my browser's security setting on Medium.

Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


Instead of
Microsoft.XMLHTTP
try
MSXML2.XMLHTTP
or
MSXML2.ServerXMLHTTP
or
MSXML2.XMLHTTP.3.0

Tried them. None of them work. Same error msg, except for
"MSXML2.ServerXMLHTTP" which produces "Error: Object doesn't support
this property or method"

Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----


I'd start a new post asking your question with detail about the environment.
Jul 23 '05 #21

P: n/a
Don <no@adr.com> wrote:
On Thu, 16 Sep 2004 21:47:45 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:mp********************************@4ax.com. ..
Instead of
Microsoft.XMLHTTP
try
MSXML2.XMLHTTP
or
MSXML2.ServerXMLHTTP
or
MSXML2.XMLHTTP.3.0

Tried them. None of them work. Same error msg, except for
"MSXML2.ServerXMLHTTP" which produces "Error: Object doesn't support
this property or method"


Method's and properties became case sensitive in later versions of
MSXML. Open should be open.

Regards,
Steve
Jul 23 '05 #22

P: n/a
Don
On Thu, 16 Sep 2004 21:33:43 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:lb********************************@4ax.com.. .
On Thu, 16 Sep 2004 20:03:50 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:


[snip]
That's it, you've got it! I changed it in the following script, and
it works just great now. THANK YOU! THANK YOU!

I was hoping to have the display occur on the same browser window that
this page runs under, so the client can utilize the "back" button if
he wants. Any idea how to do that?

Thanks much for all your help. Sure nice to have these newsgroups.
Don't know what I'd do without them.

Don


To have the back button enabled write something to the current page then
have the script do a "document.write()" instead of "wind.document.write()".

Try the following "as-is"; watch for word-wrap.

<html>
<head>
<title>Test</title>
<script type="text/javascript">
var strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
function get_page(URL) {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",URL,false);
xmlhttp.send();
return xmlhttp.responseText;
}
function put_page() {
var strPageBody = get_page(strPageURL);
alert(strPageBody);
document.write(strPageBody);
}
</script>
</head>
<body>
<a href="javascript:put_page()">Click Me!</a>
</body>
</html>
May I point out the foillowing about your code:

1) you don't need:

language="JavaScript"
<!--
// -->

2) When you use a function() you "return" a value not set a global
variable from within it.

3) Similarly, the function's parameter diesn't have to be a global
variable.

4) Why are you doing this? (See my code above.)

var strPageURL = [];
var strPageBody = [];

5) Why are these declared? They're not used:

var userName;
var password;

6) Omit the trailing "/" from "strPageURL" as it causes a 404 error.

7) Use indentation under <script> for readability.

Hi McKirahan,

Sorry I didn't reply earlier, but my wife and I just got back from
spending the weekend with our children in California.

I tried your code above, and find it works fine as long as it is run
from my desktop. But,I get an "Error: Permission denied" when I run
it from my host server. Sure wish I could get that working, as I
think I've got just about everything else under control.

Thanks also for your comments on the code. I don't have that much
experience with JS yet. So, I do appreciate your help very much.

Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #23

P: n/a
"Don" <no@adr.com> wrote in message
news:3u********************************@4ax.com...
On Thu, 16 Sep 2004 21:33:43 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
[snip]
Hi McKirahan,

Sorry I didn't reply earlier, but my wife and I just got back from
spending the weekend with our children in California.

I tried your code above, and find it works fine as long as it is run
from my desktop. But,I get an "Error: Permission denied" when I run
it from my host server. Sure wish I could get that working, as I
think I've got just about everything else under control.

Thanks also for your comments on the code. I don't have that much
experience with JS yet. So, I do appreciate your help very much.

Don


When I run it via
http://localhost/Test.htm
I get the following dialog:

"This page is accessing information that is not under its control.
This poses a security risk. Do you want to continue? [Yes] [No]"

If I click "No" then I get your "Permission denied" error on the following
line:

xmlhttp.Open("Get",URL,false);

[ I have Microsoft's Visual Studio installed so I am offered the option to
debug. ]

Basically, its saying that pages running under the Web server do not have
access to this object.

I've only used this technique inside of scripts not hosted Web pages.

You might experiment with changing your browser's security settings.
Jul 23 '05 #24

P: n/a
Don
On 16 Sep 2004 08:40:49 -0700, Lee <RE**************@cox.net> wrote:
Don said:

Well, I'm making progress, but have a little problem with the
following embedded script. It's supposed to read the body of a page
into an array, then open a window on which it is then displayed. I
have some debug "alert" statements embedded, and find the page body
(strPageBody) is null after being read from the web site.


<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--


Get rid of that comment and it's mate. They're not needed, anymore.

//
var strPageURL = [];
var strPageBody = [];


Here, you're declaring these variables as local arrays.
Later you assign a string (not array) value to strPageURL,
but you never assign any value to the local strPageBody.
In the function get_page(), you assign a string value to an
entirely different global variable with the same name.

The simplest fix is to simply remove the line declaring
strPageBody to be a local array. That way, only the global
variable (containing a string) will exist, and that turns out
to be what you want, in this case.

//
// Get page
//
strPageURL = "http://silvereaglenest.com/htmltestpage.htm";
get_page (strPageURL);
//
// Display page
//
alert ("Body just before display: "+strPageBody);
var wind = window.open();
wind.document.write(strPageBody);


It's not safe to try to write into a window that you've just
opened. The operating system may not have actually opened
the new window, yet, at the time that you try to access its
document. Use:

window.open("javascript:opener.strPageBody");

That will allow the new window to reach back into the current
window and load the value of the *global* strPageBody variable
as its content.

//
//
function get_page(strPageURL)
{
var userName;
var password;
//
alert ("URL at start of function: "+strPageURL);
alert ("Body at start of function: "+strPageBody);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get",strPageURL,false);
xmlhttp.send();
strPageBody = xmlhttp.responseBody;
alert ("Body at end of function: "+strPageBody);
}
//-->
</script>
</body>
</html>


I tried the "window.open("javascript:opener.strPageBody") and it
worked much better. Thanks. Also, thanks for the other suggestions.

The ony problem I think I've got left is that I get "Error: Permission
denied" when I run the page from my host server. Do you have any idea
how I can deal with this?

Thanks, Don

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #25

P: n/a
Don
On Tue, 21 Sep 2004 11:50:05 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:3u********************************@4ax.com.. .
On Thu, 16 Sep 2004 21:33:43 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:


[snip]
Hi McKirahan,

Sorry I didn't reply earlier, but my wife and I just got back from
spending the weekend with our children in California.

I tried your code above, and find it works fine as long as it is run
from my desktop. But,I get an "Error: Permission denied" when I run
it from my host server. Sure wish I could get that working, as I
think I've got just about everything else under control.

Thanks also for your comments on the code. I don't have that much
experience with JS yet. So, I do appreciate your help very much.

Don


When I run it via
http://localhost/Test.htm
I get the following dialog:

"This page is accessing information that is not under its control.
This poses a security risk. Do you want to continue? [Yes] [No]"

If I click "No" then I get your "Permission denied" error on the following
line:

xmlhttp.Open("Get",URL,false);

[ I have Microsoft's Visual Studio installed so I am offered the option to
debug. ]

Basically, its saying that pages running under the Web server do not have
access to this object.

I've only used this technique inside of scripts not hosted Web pages.

You might experiment with changing your browser's security settings.


OK. I'll try some other things. Thanks very much for your help.

Don

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #26

P: n/a
Don
On Fri, 17 Sep 2004 06:47:32 GMT, Steve van Dongen
<st*****@hotmail.com> wrote:
Don <no@adr.com> wrote:
On Thu, 16 Sep 2004 21:47:45 GMT, "McKirahan" <Ne**@McKirahan.com>
wrote:
"Don" <no@adr.com> wrote in message
news:mp********************************@4ax.com ...
Instead of
Microsoft.XMLHTTP
try
MSXML2.XMLHTTP
or
MSXML2.ServerXMLHTTP
or
MSXML2.XMLHTTP.3.0

Tried them. None of them work. Same error msg, except for
"MSXML2.ServerXMLHTTP" which produces "Error: Object doesn't support
this property or method"


Method's and properties became case sensitive in later versions of
MSXML. Open should be open.

Regards,
Steve

Thanks Steve.
Regards,
Don
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 23 '05 #27

This discussion thread is closed

Replies have been disabled for this discussion.