473,387 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Detect Browser Close for Window with Multiple Tabs (IE7)

3
Hello,

I need to detect when the red X button on the browser window is clicked then logoff the session. It works only when the browser has a single tab because it meets the condition window.event.clientY < 0. However, when there are multiple tabs and user needs to respond to "Do you want to close all tabs" alert, window.event.clientY is no longer negative. This is for IE 7. Any suggestions?

Thank you.
Mar 12 '10 #1
4 5166
acoder
16,027 Expert Mod 8TB
That's a bit of a hack.

Can you not use a session timeout instead? E.g. 30 minutes of inactivity results in the session being invalidated.
Mar 13 '10 #2
peepio
3
There's a session time limit but we also need to detect this event to logout the current user.
Mar 13 '10 #3
acoder
16,027 Expert Mod 8TB
One possibility is the onbeforeunload event, but that would fire for all unloads including reload and going back and forward.

I'm still not sure why you'd want to log the user off when they close the window.
Mar 14 '10 #4
peepio
3
acoder,

I'm using the onbeforeunload event but as you've mentioned it is fired in all cases so I need some sort of condition to identify browser close action.

The user needs to be logged out of the system otherwise the user won't be able to log back into the system until after the session has timed out.
Mar 15 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: hb | last post by:
Hi, Would you please tell me how to detect if the client's browser is closed? I need such event to trigger a database modification. Thank you hb
3
by: Lord2702 | last post by:
Sat. Oct. 30, 2004 3:25 PM PT I want to detect, if user has close the browser, (after logging to my site), that user has closed the browser. How to achieve it ? I want to know this close action...
9
by: WRH | last post by:
Hello I am new to asp but I made some Jscript functions which work fine. The functions contain some strings used as a registration key for some apps. It is important that these strings not be...
8
by: Luke Matuszewski | last post by:
I have read all posts about how to detect that url have changed to new page and trigger the event handler then eg. function aidLogout(evt) { if(evt) { /* maybe via analyse of evt object i can...
17
by: DaveC | last post by:
Hi, If I set up a link to take my viewers away from my site, how can I force their browser to open a second copy? Idea, of course, is to bring viewers back into my site when they close the 2nd...
8
by: jaibux | last post by:
Everybody knows how to open (or clone) the same page that you are viewing in a new browser window by CTRL+N or via File->New Window. the question is how to PREVENT to open the SAME WEB APPLICATION...
7
by: Danny | last post by:
Hello: I would like to develop a browser extension, or whatever such a thing is classified as, that would allow a user of IE6, and possibly IE7, to switch between a live and development page. ...
7
by: Andrew Poulos | last post by:
Is there a way for javascript to know if a browser has been set to open new windows in tabs? I'm trying to fix some code that allows a user to close a window that javascript opened and it seems to...
1
by: smilyswapna10 | last post by:
hi, I am working on the IE7 browser. when click on the close(X) button i need a conformation same as i open the multiple tabs in a single browser and while i closing the tabs also i need a...
0
by: dolittle | last post by:
In my application the browser window connect with long polling(comet) with the server. If the user open several browser tabs, only one of them(called the master) communicate with the server and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.