473,480 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do you determine the reason for an UNLOAD

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.TheRepor tTypes.value ==
event.returnValue = "The Summary has not been saved!"
--></script></HEAD><body onbeforeunload="PageBeforeUnloadCheck()"
..
</body></HTML

My problem is that the java function PageBeforeUnloadCheck is executed for every PostBack, not just when the page is going to change or the browser closed. After some thought, this makes sense because the client site does not know what the response will be, it might be a new page address. My problem is that I cannot figure out how the java script can know what action the client took. Was it a button press, the change in selection of a dropdownlist, or ...

What variable/parameter/attribute can the script use to determine the user action?
Nov 20 '05 #1
2 1308
I think I have figured it out. I found "document.activeElement.id". This seems to give the id of the last button clicked. What I can do is check it. Since closing the window does not update this property, I find I can set it to "" after my check and then when the window is closed the value is "" not the last button's id.
Nov 20 '05 #2
Wrong group.

Try the .aspnet group

Shane

"Michael SL" <mi*****************@compuware.com> wrote in message
news:4B**********************************@microsof t.com...
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.TheRepor tTypes.value == {
event.returnValue = "The Summary has not been saved!";
}
}
--></script></HEAD><body onbeforeunload="PageBeforeUnloadCheck()">
...
</body></HTML>

My problem is that the java function PageBeforeUnloadCheck is executed for every PostBack, not just when the page is going to change or the browser
closed. After some thought, this makes sense because the client site does
not know what the response will be, it might be a new page address. My
problem is that I cannot figure out how the java script can know what action
the client took. Was it a button press, the change in selection of a
dropdownlist, or ....
What variable/parameter/attribute can the script use to determine the user

action?
Nov 20 '05 #3

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

Similar topics

5
20818
by: Harry J. Smith | last post by:
I have written a Visual Basic program that does a long calculation and writes the results to disk as it runs. If I click the Close button the window closes but the program keeps running. How can I...
0
4056
by: razheev | last post by:
Hi, I have a Table which contains 1 million rows. I want to do an unload of the table and do some massaging (tranforming) of data and do a load to a different table where the column attributes are...
13
7616
by: Gittyup | last post by:
Help please, We have a form, based on a query, that contains a listbox. The contents of the listbox are based on the results of the query. When the form is opened, the user selects an item...
2
10815
by: Lauren Hines | last post by:
Hello, I have read numerous post stating that the only way to unload an assembly (DLL in my case) is to create a separate AppDomain, load the assembly, then unload it by calling AppDomain.Unload....
1
2630
by: hal | last post by:
I have an application that includes an activex component that consumes resources that must be released when the a page is unloaded. Toward this end I subscribe to the unload event of the body...
1
2917
by: Hal | last post by:
My most sincere gratitude to anyone who can help me work around this! I have work that needs to be done in javascript on the client whenever a page is unloaded. To this end, I subscribe to...
3
3196
by: Gauthier Segay | last post by:
Hello, I've an application where all my pages implement a PAGE_CODE string property, this property is stored in HttpContext.Current.Items. In some page, I must persist data in session while...
0
1023
by: Brett Smith | last post by:
I have a winforms app that access a web resource using forms authentication. I programatically login to the site, and catch the cookies. I then pass the cookies to my httpwebrequest. I neet to...
11
8606
by: Timofmars | last post by:
I'm try to Unload DB2 data from a table into a record sequential file on NT. I can an unload on Mainframe, but it doesn't seem to be an option in NT. In NT, all I can do is export/import. I can...
0
7037
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,...
0
7076
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6730
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...
0
6873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5321
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,...
1
4767
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...
0
2990
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...
0
1294
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 ...
0
174
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...

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.