actually if session is going on and user directly close the browser close button then it shows some alert. and by seeing that alert he can continue or cancel the alert.
23477
I tried the following code to get an alert upon closing a browser window:  window.onbeforeunload = confirmExit; function confirmExit() {   return "You have attempted to leave this page.  If you have made any changes to the fields without clicking the Save button, your changes will be lost.  Are you sure you want to exit this page?"; }   It works, but if the page contains one hyperlink, clicking on that hyperlink raises the same alert. I need to show the alert only when I close the browser window and not upon clicking hyperlinks.
68735
I would like to be able to kill a user's query in Oracle 10.2.0.4 without killing their entire session.  This would allow the query to end, but not log that user out of their session, so they can continue making other queries.  Is this possible at all?  Or is the blunt hammer of killing the session the only way to go about ending a query's execution?
16294
Is it possible to detect, on the client side, whether the user is using an encrypted page or not?  Put another way -- I want to know if the URL of the current page starts with http or https.
101886
How do you prevent programs from obnoxiously opening the browser on their own accord?  It's unbelievable that programs/developers feel so entitled as to A.) open another program on one's computer, and B.) then have the gall to browse to whatever site or advertisement they so please.  cough... Revo Uninstaller
23342
I was thinking whether it is possible to have some animation on Stack Overflow.  For instance, if a message comes then there should be a beep sound so that users can be alerted. I know that presently notifications are shown in red on the global inbox to mark its presence, but, if user is on some other tab or browser, then it is quite possible that he/she may not reply for quite a bit of time.   I thought by this way the comments can easily seek some attention quickly!
25663
How would I have a  action that may have some effects on the current page but would also change the URL in the browser so if the user hits reload or bookmark, then the new URL is used?    It would also be nice if the back button would reload the original URL.  I am trying to record JavaScript state in the URL.
22609
I have recently observed many sites that do not have a log out button. Either it's not there or hidden somewhere so that you have to find it. Why do you think this has been done? Does it apply to every category of site - for example a social networking site versus a banking site?
11174
I have a few places where I use the line below to clear out a status, for example.  I have a few of these that hang out for 10 seconds or more and if the user gets clicking around the action can occur at incorrect time intervals.  window.setTimeout(function() { removeStatusIndicator(); }, statusTimeout);   Is it possible to cancel or kill this with some jQuery or JavaScript code, so I don't have this process hanging around?
31942
Actually, this question struck me because of power cuts in my house. When there is a power cut, there is a sudden loss of power from the computer.   How does the computer know that the shutdown was not properly done?
81297
If I hit a page which calls session_start(), how long would I have to wait before I get a new session ID when I refresh the page?
112582
I'm sorry if this isn't the place to ask this, but there doesn't seem to be a web security stack exchange site, so this looks like the closest thing to me. If there's a better place to put this question please let me know.  I'm using Firefox on Ubuntu and I accidentally clicked an ad that took me to an obvious scam site. There's no changed behavior on my computer, but just to be safe I'd like to know what you should do after visiting an unsafe site. Thanks
25019
How can I close a browser window without receiving the Do you want to close this window prompt?  The prompt occurs when I use the window.close(); function.
40140
Take a look on this friendly robot:   Looks innocent, right? Well, he is not.  I just went over the list of question on a , the home of that robot and tried to upvote a question I liked:        The robot appeared and explained to me I actually can't vote. Trying my luck, I clicked again. The dialog re-appeared as expected.  Time to give up, I wanted to read the other questions. I clicked the "cancel" in the dialog. Nothing happens. I clicked outside the dialog. Nothing happened. The robot is there to stay, and won't leave until I reload the page!  I know, I misbehaved by clicking twice, but still... do I deserve such extreme punishment? Can it please be closed when clicking "cancel" even if I clicked more than once?
37456
If you are editing a question and decide to close the tab/window/whatever, SO opens up a dialog box asking you if you are sure. The buttons for this dialog are "OK" and "Cancel". However, what these map to is not entirely obvious. It would make more sense to change them to action words describing what they do. For example, it could be "Close this Question" and "Stay Here". This would eliminate the need to explain which button does what in the dialog itself and require less work from the user.
50903
I'd think this would work just fine, but it seems to prevent the action function from firing regardless of the confirm response  &lt;apex:commandButton value="Remove All" action="{!removeAll}" rerender="form"      status="LoadingStatus" onclick="return confirm('Are you sure?');"/&gt;
60241
What is the best way to close an ASPX page from the code-behind?    I have a button event handler that I want to close the page after the user has clicked an ASP.NET button on the page.  I have tried to programmatically add a JavaScript method that contains a window.close() command to the OnClientClick event to close the page but it does not work.  The button is also a asp:AsyncPostBoskTrigger for an AJAX Update Panel.  The application uses .NET Framework 3.5.
96876
We're working on an internal business app, and throughout the process the users have been very involved in all aspects of the design. They have explained their workflow, terminology, etc. and the app models that as closely as possible, with their input at every step.  Most actions in the app can be undone, but there's one action that (per the users' instructions) can't be undone without going into the database and manually changing data. In order to confirm this action, the user has to click "yes" on a modal alert. Alerts are used very rarely in the app; there's only one other action that will bring about an alert.  Neither action is performed very frequently.  However, the users are still somehow occasionally clicking on the wrong action and confirming their choice in the alert (presumably ignoring the text on it).  What's the best way to remedy this?   The text in the alert is a bit long, so we're looking at making it shorter and more to the point, and maybe renaming the buttons so they aren't just yes/no, but we don't know if that's enough. Is there some other way to draw the users' attention and make them really realize what they're doing? Are there proven ways to reduce errors like this?    Our ultimate solution: For now, we're focusing on changing the text and appearance of the alert dialog, as per Matt Lavoie's and André's answers. We made the text shorter and more to the point, added a caution icon and a clear statement that the action can't be undone, and changed the buttons to say what they'll do and not just yes/no.   We also changed the text on the button that launches the action to be red and in caps (all the other button texts are in black and just first letter capitalized).  Finally we made the entire background of the app go bright red when the alert dialog comes up. It's quite jarring, so the users should definitely notice it.  We mentioned the changes we're making to the users, and they were totally in favor of it. If these aren't sufficient we'll add additional input requirements to the alert, as in Andrew Leach's and JeffH's answers.