How to prevent explorer from being closed.

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
renu
Forum Commoner
Posts: 30
Joined: Sat Nov 06, 2004 12:20 am

How to prevent explorer from being closed.

Post by renu »

Hi
I want to ask for logout when user closes browser .and if user says no then browser should not be closed.I'm able to display alert message for logout but cant stop the explorer from being stopped.
Can anyone help me.
thanx
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Why not re-think you design so you dont have to resort to javascript.. as some people wont have it enabled.

Store their session in a database and crosscheck last activity, if passed a certain point log them out.
renu
Forum Commoner
Posts: 30
Joined: Sat Nov 06, 2004 12:20 am

Post by renu »

Hi Phenom

Closing session is not a problem.but my requirement is tht when user close
the browser i want to ask him for logging out.if he doesn't logout then browser shouldn't be closed.
In short ,before closing the browser i want to put a check on tht event.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

apart from javascripts onUnload-event there is nothing you can do. And be grateful for it - imagine websites refusing to be closed until you've looked at their "special offers".
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

renu wrote:Hi Phenom

Closing session is not a problem.but my requirement is tht when user close
the browser i want to ask him for logging out.if he doesn't logout then browser shouldn't be closed.
In short ,before closing the browser i want to put a check on tht event.
Oh if this was possible it would make all of our user authentication scripts better :)
Post Reply