473,748 Members | 6,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cancel the 'unload' action in 'onbeforeunload ' event

What code can I put in the 'onbeforeunload ' event to cancel the 'unload'
action (when user closes browser) and then present the user with an
alert saying that he/she must use the logout button.

Jul 23 '05 #1
6 15892
On Mon, 19 Jul 2004 10:13:43 -0400, Marcia Gulesian wrote:
What code can I put in the 'onbeforeunload ' event to cancel the 'unload'
action (when user closes browser) and then present the user with an
alert saying that he/she must use the logout button.


....Bwa! Ha Haaaa Ha Haaa... good one!
What? ..You're *serious*?

What happens when the user presses these keys?
<http://www.physci.org/kbd.jsp?key=ctr l+alt+del>

[ The 'user must log out' is an FAQ across HTML,
Site-Design, Java, JS... groups. You cannot
*guarantee* a log-out. ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #2
According to dhtml books from o'reilly et al, , this can be done.

Marcia Gulesian wrote:
What code can I put in the 'onbeforeunload ' event to cancel the 'unload'
action (when user closes browser) and then present the user with an
alert saying that he/she must use the logout button.


Jul 23 '05 #3
On Mon, 19 Jul 2004 10:40:08 -0400, Marcia Gulesian wrote:

(force log-out)
According to dhtml books from o'reilly et al, , this can be done.


...and do they mention exactly how, as opposed
to vaguely waving hands about and espousing how
it *should* be possible? You're the one with
the book Marcia, what does it say?

I would be especially interested to hear how
they propose preventing the user from disconnecting
the cable that connects them to the internet,
or turning the computer off at the wall.

OTOH, I thought the c.l.js FAQ might mention
something about it.. ahh yes,
<http://www.jibbering.c om/faq/#FAQ4_29>
and.. back to where I started. 'No'.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #4
In article <40************ **@theworld.com >, mg@theworld.com enlightened
us with...
According to dhtml books from o'reilly et al, , this can be done.

Marcia Gulesian wrote:
What code can I put in the 'onbeforeunload ' event to cancel the 'unload'
action (when user closes browser) and then present the user with an
alert saying that he/she must use the logout button.



Really?
Post the source that gave you the impression that it could be done
*reliably*.

There's a very big difference between "can be done" and "can be done
reliably".

I can do a lot of things that only work in IE6 with javascript enabled
on a windows box with low security settings. Those things are generally
used in an HTA and are useless for much else. This group assumes cross-
browser internet use unless otherwise specified.

--
--
~kaeli~
Murphy's Law #3020: Quality assurance doesn't.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #5


Marcia Gulesian wrote:
What code can I put in the 'onbeforeunload ' event to cancel the 'unload'
action (when user closes browser) and then present the user with an
alert saying that he/she must use the logout button.


Well check the documentation, here it is:
http://msdn.microsoft.com/library/de...foreunload.asp

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #6
Thanks!

Martin Honnen wrote:
Marcia Gulesian wrote:
What code can I put in the 'onbeforeunload ' event to cancel the 'unload'
action (when user closes browser) and then present the user with an
alert saying that he/she must use the logout button.


Well check the documentation, here it is:
http://msdn.microsoft.com/library/de...foreunload.asp

--

Martin Honnen
http://JavaScript.FAQTs.com/


Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2476
by: Dalan | last post by:
Although I have used the code below to suppress the DoCmd cancel action message from appearing on lots of other actions such as preview and print, I have not been able to get to work on a BeforeUpdate Event Procedure. There is nothing elaborate about the event, however, there is an initial message box stating that if one field contains data then a second one must also, and then after clicking okay, the DoCmdMenuItem action box is...
7
2516
by: MLH | last post by:
I tried the following code to prevent a checkbox from being updated (going from a value of Null to True, from True to False or from False to True). I was surprised it did not work. Can anyone offer a sensible, logical, insightful reason as to why Microsoft does not want to let programmers stop this event? Private Sub NoOwnerInfoChkBox_Click() If CurrentVehicleJobID = 0 Then
6
18428
by: Mike | last post by:
I have a web form in my application that will be used for both viewing and updating information. I have a requirement that if any data has been changed on the page and the user attempts to leave the page without saving, the user gets prompted with a message asking if they want to save changes. It seemed logical to put any code to handle this in the page unload event, however the page unload event gets fired every time the page does a post...
2
1333
by: Michael SL | last post by:
When a client requests to leave a Web Page, I want the web page to check for a certain condition. If that condition is met, I want to prompt the user to make sure they want to leave The method I am currently using is <HTML><HEAD .. <script><!- function PageBeforeUnloadCheck( .. if (...)AdministratorStatusReportSummaryForm.TheReportTypes.value ==
0
1650
by: Joe E. | last post by:
I have a .ASPX page in an iFrame and when the SRC of the iFrame changes the page_unload event does not fire. In order to get this event to fire, I tried using the onbeforeunload event in the body tag to submit the form with javascript. The only problem I have had with this is that IE SP2 does not let you submit onunload or onbeforeunload unless you prompt the user or display some kind of message to the user. Does anyone know a way...
1
4115
by: David | last post by:
I am using a process to warn users when they leave a page that there have been changes made. I took the example directly from Microsoft example I found in searching for help on the event onbeforeunload. I have the event inside the BODY element in my aspx page and it seems to work just fine. However, I still get a flash of a page error in the lower left corner of my browser and the Visual Studio 2005 "souce" page shows the event name...
2
30666
gregerly
by: gregerly | last post by:
I'm working on a corporate intranet site and am trying to create a page that will warn a user on window unload if they have not saved thier work. Basically I just select all inputs, and on change, set var changes = true; On window unload if changes==true, they have made changes that are not yet saved, and I want a confirm box to pop up, asking if they really want to leave or stay on the page? At this point is it to late to cancel the window...
3
3306
by: nareshreddy | last post by:
Hi i am using the below code to close the window and i l get promt when click on 'X' button on ie browser with OK and Cancel buttons. if i click ok window will be closed, if i click cancel window wont close. what i need is if i click ok also it should perform as a cancel and the window should not close. thanks in advance. <SCRIPT FOR = "window" EVENT = "onbeforeunload"> event.returnValue = "If you wish to keep this session...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.