How To Disable Button Close On Browser For Web Application?
I have Application Web based ASP.Net Framework 1.0, for security i want Button Close (X) in browser(ie,firefox,opera etc.) is disable and reason anything make browser exit, user on
Solution 1:
You can't do this, sorry. You'll have to implement a server-side timeout mechanism, etc. You can make it a fairly short timeout and use an ajax request behind-the-scenes to keep the session alive, but you cannot prevent the browser from closing.
And really, you don't want to rely on doing so anyway, because browsers can crash rather than close, computers can get unplugged rather than shut down properly, etc., all without your server being notified. So you have to handle the fact that people can abruptly disappear anyway.
For the normal use case, you can encourage your users to use the Logout link instead using JavaScript:
<script>window.onbeforeunload = function() {
if (loggedIn) {
return"Please cancel and use the Logout link instead";
}
};
</script>
...which will nag them on most (but not all) browsers, but you can't make them do it.
Post a Comment for "How To Disable Button Close On Browser For Web Application?"