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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
R_HarrisonConnect With a Mentor Commented:
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
 
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Joachim CarreinSr. Software DeveloperCommented:
response.Write "<script language=javascript>window.close();</script>"
0
 
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
All Courses

From novice to tech pro — start learning today.