suran78
asked on
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
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
you'll need to do this with javascript. but then the user still gets a message (you want to close this window?)
ASKER
Yes, that will work. Please provide the code.
Thanks.
Thanks.
response.Write "<script language=javascript>window .close();< /script>"
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
and press enter, this is what the users will get then
ASKER
Shoudl this be pasted after submission button? Which is the best location?
ASKER
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?"
Add the code below to your page.
<SCRIPT>
function CloseWin()
{
window.close()
}
set Timeout("CloseWin()", 60000)
</SCRIPT>
<SCRIPT>
function CloseWin()
{
window.close()
}
set Timeout("CloseWin()", 60000)
</SCRIPT>
ASKER
It's not closing, I tried it:
<script Language="JAVAScript">
function CloseWin()
{
window.close()
}
set Timeout("CloseWin()", 60000)
</script>
<script Language="JAVAScript">
function CloseWin()
{
window.close()
}
set Timeout("CloseWin()", 60000)
</script>
ASKER
getting error "expected ;"
on line - set Timeout("CloseWin()", 60000)
on line - set Timeout("CloseWin()", 60000)
setTimeout is one word not two...
Sorry, my bad.
ASKER
It worked. Thanks.
But it does not repeat the question is the user click no. Can it keep asking until the window is closed?
But it does not repeat the question is the user click no. Can it keep asking until the window is closed?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.