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

Two Basic JS Qs

P: n/a
Hi,
Two questions!

1. I have an HTML file on a local harddisk and I want to open it from
another local .js file passing it a string for it to read and display e.g.
test.html?this_is/atest so how do I do all of that?!

2. from the JS file that called the above I want to know when test.html has
closed or been closed?

Is this all possible and if so how?

thanks
Aug 11 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In a Web context, which is all I know anything about, js files are not
standalone programs. They're loaded into HTML pages and executed there as if
the code they contain were a part of that HTML page. Where not blocked by
"popup blocker" software the "included" js code can then open other windows,
which in turn may call code in the originating window (for instance, to tell
it they're being closed, though this can't be done reliably).

For instance, the window opening code you describe might be written as:

window.open("test.html?this_is/atest");

In test.html, the URL is accessible through the window.location object, and
the query component of the URL (the part after the "?") is in
window.location.search. The writing code might then look like:

document.write(window.location.search);

If your needs are strictly what you describe, you might also want to take a
look at whatever platform-specific system-level scripting software is
available to you.

--
Joakim Braun
"Adrian" <Ad****@nospamhotmail.com.uk> skrev i meddelandet
news:dd**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Hi,
Two questions!

1. I have an HTML file on a local harddisk and I want to open it from
another local .js file passing it a string for it to read and display e.g.
test.html?this_is/atest so how do I do all of that?!

2. from the JS file that called the above I want to know when test.html has closed or been closed?

Is this all possible and if so how?

thanks

Aug 11 '05 #2

P: n/a
Hi
Thanks for your reply it has given me something to look at this weekend.

Yes it is as I describe the OS will be windows XP Pro and as such you can
run .JS files directly! but I guess once the HTML is open the same commands
may work!

I'm out tomorrow so I will try what you suggest over the weekend and let you
know how it goes

Thanks for your help

"Joakim Braun" <jo**********@jfbraun.removethis.com> wrote in message
news:83******************@nntpserver.swip.net...
In a Web context, which is all I know anything about, js files are not
standalone programs. They're loaded into HTML pages and executed there as
if
the code they contain were a part of that HTML page. Where not blocked by
"popup blocker" software the "included" js code can then open other
windows,
which in turn may call code in the originating window (for instance, to
tell
it they're being closed, though this can't be done reliably).

For instance, the window opening code you describe might be written as:

window.open("test.html?this_is/atest");

In test.html, the URL is accessible through the window.location object,
and
the query component of the URL (the part after the "?") is in
window.location.search. The writing code might then look like:

document.write(window.location.search);

If your needs are strictly what you describe, you might also want to take
a
look at whatever platform-specific system-level scripting software is
available to you.

--
Joakim Braun
"Adrian" <Ad****@nospamhotmail.com.uk> skrev i meddelandet
news:dd**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Hi,
Two questions!

1. I have an HTML file on a local harddisk and I want to open it from
another local .js file passing it a string for it to read and display
e.g.
test.html?this_is/atest so how do I do all of that?!

2. from the JS file that called the above I want to know when test.html

has
closed or been closed?

Is this all possible and if so how?

thanks


Aug 11 '05 #3

P: n/a
JRS: In article <dd**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com>,
dated Thu, 11 Aug 2005 17:49:01, seen in news:comp.lang.javascript,
Adrian <Ad****@nospamhotmail.com.uk> posted :
1. I have an HTML file on a local harddisk and I want to open it from
another local .js file passing it a string for it to read and display e.g.
test.html?this_is/atest so how do I do all of that?!

2. from the JS file that called the above I want to know when test.html has
closed or been closed?

Is this all possible and if so how?


That class of question is on-topic, but there is here less expertise in
answering what it appears to be than might be found in groups
news:microsoft.public.scripting.(wsh,jscript). Here we primarily in
practice deal with script on web pages.

<FAQENTRY> Those newsgroups should be mentioned somewhere in 2.1 2.7 or
3.2 </FAQENTRY>.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
Aug 12 '05 #4

P: n/a
OK thanks I will try that group
"Dr John Stockton" <jr*@merlyn.demon.co.uk> wrote in message
news:CF**************@merlyn.demon.co.uk...
JRS: In article <dd**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com>,
dated Thu, 11 Aug 2005 17:49:01, seen in news:comp.lang.javascript,
Adrian <Ad****@nospamhotmail.com.uk> posted :
1. I have an HTML file on a local harddisk and I want to open it from
another local .js file passing it a string for it to read and display e.g.
test.html?this_is/atest so how do I do all of that?!

2. from the JS file that called the above I want to know when test.html
has
closed or been closed?

Is this all possible and if so how?


That class of question is on-topic, but there is here less expertise in
answering what it appears to be than might be found in groups
news:microsoft.public.scripting.(wsh,jscript). Here we primarily in
practice deal with script on web pages.

<FAQENTRY> Those newsgroups should be mentioned somewhere in 2.1 2.7 or
3.2 </FAQENTRY>.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00
MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, &
links.
Proper <= 4-line sig. separator as above, a line exactly "-- "
(SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> "
(SonOfRFC1036)

Aug 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.