
How to stop execution run-time and relocate
I have a client-side script using ADO connection. If the connection fails,
I want to redirect the user back to the login page, like this:
try
{
objConn.Open( ....opening details....);
}
catch(exeption)
{
if( exeption.number == ........)
{
window.alert("Login failed, you will be redirected to the login
page");
location.href = "login.asp"
}
}
The problem is, the script execution will continue on this page, with
consequent errors. Relocation seems not to be instant when you execute the
'location.href = ....'
How do you instantly stop execution and relocate?