469,287 Members | 2,540 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,287 developers. It's quick & easy.

Close page after it loads?

Is it possible to close a page using Javascript that will close *after* the
page is loaded (it's an ASP page that performs an action).
Sep 16 '05 #1
5 10215
Steve <st***@hello.com> wrote:
Is it possible to close a page using Javascript that will close *after* the
page is loaded (it's an ASP page that performs an action).


<html>
<head>
<script>
function ready() {
window.close();
}
</script></head>
<body onload="ready();">
</body></html>

? Insert whatever actions you need to perform before window.close().

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Sep 16 '05 #2
Christopher Benson-Manica said the following on 9/16/2005 12:04 PM:
Steve <st***@hello.com> wrote:

Is it possible to close a page using Javascript that will close *after* the
page is loaded (it's an ASP page that performs an action).

<html>
<head>
<script>
function ready() {
window.close();
}
</script></head>
<body onload="ready();">
</body></html>

? Insert whatever actions you need to perform before window.close().


"Script is attempting to close the page......."

And yes, I can make IE close a window that script didn't open. The
Unconditional Truth will set you free if you search the archives for it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Sep 16 '05 #3
Randy Webb <Hi************@aol.com> wrote:
And yes, I can make IE close a window that script didn't open. The
Unconditional Truth will set you free if you search the archives for it.


Hm, I see, although it seems that defeating protection offered by the
browser should be done with care.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Sep 16 '05 #4
Christopher Benson-Manica said the following on 9/16/2005 1:22 PM:
Randy Webb <Hi************@aol.com> wrote:

And yes, I can make IE close a window that script didn't open. The
Unconditional Truth will set you free if you search the archives for it.

Hm, I see, although it seems that defeating protection offered by the
browser should be done with care.


Whether that protection is offered by the browser is debatable though.
Mozilla based browsers do not allow it, in any form. Other browsers do,
and IE does it back to at least IE5.0/Win so it's hard to claim it as a
bug, and if it's not a bug then it's an undocumented feature. And IE is
not the only browser that does it.

So, if a browser intentionally allows you to do it, then how is that
browser safeguarding against it?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Sep 16 '05 #5
Steve wrote:
Is it possible to close a page using Javascript that will close *after*
the page is loaded (it's an ASP page that performs an action).


Why not have the ASP page return a 204 response instead?
http://www.w3.org/Protocols/rfc2616/...html#sec10.2.5

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Sep 16 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Andras Gilicz | last post: by
1 post views Thread by Marshall Dudley | last post: by
3 posts views Thread by Joris De Groote | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.