Tuesday, July 26, 2011

Redirect Page to Index(Login) after Logout

If you had trouble to force your page to login page again after logout. I have the solution for you that I use in Javascript. It work fine in IE. You can try it out too.



<script>
function backButtonOverride()
{
// Work around a Safari bug
// that sometimes produces a blank page
setTimeout("backButtonOverrideBody()", 1);
}
function backButtonOverrideBody()>
{
// Works if we backed up to get here
try {
history.forward();
} catch (e) {
// OK to ignore
}
// Every quarter-second, try again. The only
// guaranteed method for Opera, Firefox,
// and Safari, which don't always call
// onLoad but *do* resume any timers when
// returning to a page
setTimeout("backButtonOverrideBody()", 500);
window.location = "index.php";
}
</script>

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...