Close browser window

Experts,

I have a ASP submission form.  After user submits it, i want the ASP code to close the submission form after 1 min autmatically.  Please give me the code in asp/vbscript to close the submission window automatically.

Thanks.
suran
suran78Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Joachim CarreinSr. Software DeveloperCommented:
you'll need to do this with javascript. but then the user still gets a message (you want to close this window?)
0
suran78Author Commented:
Yes, that will work.  Please provide the code.
Thanks.
0
Joachim CarreinSr. Software DeveloperCommented:
response.Write "<script language=javascript>window.close();</script>"
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Joachim CarreinSr. Software DeveloperCommented:
you can try this easy in your browser, in the address bar type javascript:window.close();
and press enter, this is what the users will get then
0
suran78Author Commented:
Shoudl this be pasted after submission button?  Which is the best location?
0
suran78Author Commented:
OK, but I want the window to close automatically after 1 min, if the user forget to close it after submitting the form.  Is there anyway to close the browser automatically?  And yes when the code behind closes it automatically after 1 min, it can ask the question "do you want to close?"

0
R_HarrisonCommented:
Add the code below to your page.

<SCRIPT>
function CloseWin()
{
window.close()
}
set Timeout("CloseWin()", 60000)
</SCRIPT>
0
suran78Author Commented:
It's not closing, I tried it:

<script Language="JAVAScript">
  function CloseWin()
{
window.close()
}
set Timeout("CloseWin()", 60000)

</script>
0
suran78Author Commented:
getting error "expected ;"
on line -  set Timeout("CloseWin()", 60000)
0
R_HarrisonCommented:
setTimeout is one word not two...
0
R_HarrisonCommented:
Sorry, my bad.
0
suran78Author Commented:
It worked.  Thanks.
But it does not repeat the question is the user click no.  Can it keep asking until the window is closed?
0
R_HarrisonCommented:
Yes, just add the setTimeout statement into the function after the window.close as below..

<script Language="JAVAScript">
function CloseWin()
{
window.close()
setTimeout("CloseWin()", 60000)
}
setTimeout("CloseWin()", 60000)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.