Close browser window.

M

MichaelK

What's the best way to close current window silently after finished a
process.
I'm using the the javascritpt window.close() or top.window.close(), but it
fires a confirmation window.
Just want to close it without any confirmation, seems I done it before, but
can't find where.

Thanks,
Michael.
 
R

Ray Costanzo [MVP]

This is not an ASP question, since it's all client-side stuff. One of the
things that may work in browsers today, but shouldn't in the future, is:

window.opener = window;
window.close();

Example:
<htmL>
<body>
<input type="button" onclick="closeIt(false);" value="Close with
confirmation" />
<input type="button" onclick="closeIt(true);" value="Close without
confirmation, probably" />
<script type="text/javascript">
function closeIt(b) {
if(b) { window.opener = window; }
window.close();
}
</script>
</body>
</html>

Ray at home
 
M

MichaelK

Thanks Ray, it's closing window without confirmation, exactly what I was
looking.

Well about not an ASP question, it's how to look at it.
Based on server side process results I generate the page with different
elements
and javascritpt modules which will work on the client side.

Anyway thanks a lot, main thing you helped me.
Regards, Michael
 
R

Ray Costanzo [MVP]

I understand what you're saying about the asp vs. javascript thing. It's
mostly for your benefit to post in the correct group though. While there
are many ASP experts floating around here, it's not uncommon for those
people to struggle with basic javascript, so you never know what you'll get
when you're in the wrong group.

Ray at home
 
M

MichaelK

Well, I would probably do, just didn't find any good organized javascript
groups.
Have you seen any good ones by chance?

Michael.
 
R

Ray Costanzo [MVP]

The one on the MS server isn't bad, it's microsoft.public.scripting.jscript.
But I believe that comp.lang.javascript is a very popular one.

Ray at home
 
B

Bob Barrows [MVP]

MichaelK said:
Thanks Ray, it's closing window without confirmation, exactly what I
was looking.

Well about not an ASP question, it's how to look at it.

Just to add to what Ray said:

If what you are asking about could be applied to a .htm file, then you are
not asking about ASP.

It is to everyone's benefit to keep these newsgroups focussed.

Bob Barrows
 
L

Larry Bud

MichaelK said:
Well, I would probably do, just didn't find any good organized javascript
groups.
Have you seen any good ones by chance?

The one you want is

comp.lang.javascript
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top