473,785 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detecting if onUnload() was called because of a refresh...

Is there a way to detect if the reason an onUnload()
handler was called originated from the user explicitly
refreshed the page(s)?

Ie. pressed "Ctrl-R", "F5" or klicked the refresh button
in the toolbar or the context menu?

I'm aware that I can not stop a refresh, but the reason
I want to know is that I have a hidden frame in an intranet
application. This hidden frame is present at all times after
the user have sucessfully logged in (to our db).

So the only time this frame is closed is when the user
navigates away from the intranet app. At which point I want
to log him/her out.

I do thid With an AJAX call in the unload-event of the hidden
frame.

*BUT*... This leads to logging out if the user presses "F5",
or in other ways refresh the window, since a refresh reloads
both frames.

So I thought that if I could detect that this was a refresh in
progress, I can avoid logging him/her out.

PS!
I only need this to work in an IE-only scenario.

TIA...

--
Dag.

Work is the curse of the drinking classes
-- Oscar Wilde
Sep 2 '05 #1
3 14795
Dag Sunde said the following on 9/2/2005 7:09 AM:
Is there a way to detect if the reason an onUnload()
handler was called originated from the user explicitly
refreshed the page(s)?
No.
Ie. pressed "Ctrl-R", "F5" or klicked the refresh button
in the toolbar or the context menu?
No.
I'm aware that I can not stop a refresh, but the reason
I want to know is that I have a hidden frame in an intranet
application. This hidden frame is present at all times after
the user have sucessfully logged in (to our db).
Not possible to know how it was loaded, only that it was loaded.
So the only time this frame is closed is when the user
navigates away from the intranet app. At which point I want
to log him/her out.
Use a session variable on the server. Never rely on the client.
I do thid With an AJAX call in the unload-event of the hidden
frame.

*BUT*... This leads to logging out if the user presses "F5",
or in other ways refresh the window, since a refresh reloads
both frames.
IFrame gets unloaded, user gets logged out.
IFrame gets reloaded, user gets logged back in.

Have the IFrame check, onload, to see if the user is logged in. If not,
refer them back to the login page. It won't take many refresh/relogins
for them to stop using the Refresh.
So I thought that if I could detect that this was a refresh in
progress, I can avoid logging him/her out.
Can't distinguish.
PS!
I only need this to work in an IE-only scenario.


Doesn't matter.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Sep 2 '05 #2
"Randy Webb" <Hi************ @aol.com> wrote in message
news:t5******** ************@co mcast.com...
Dag Sunde said the following on 9/2/2005 7:09 AM:
Is there a way to detect if the reason an onUnload()
handler was called originated from the user explicitly
refreshed the page(s)?


No.
Ie. pressed "Ctrl-R", "F5" or klicked the refresh button
in the toolbar or the context menu?


No.

<snipped />

Now, that was encouraging... ;-)

Ok... I drop that path then, and consentrate on the serverside.

Thanks for saving me a dead-end journey.

--
Dag.

Sep 2 '05 #3
Dag Sunde said the following on 9/2/2005 6:54 PM:
"Randy Webb" <Hi************ @aol.com> wrote in message
news:t5******** ************@co mcast.com...
Dag Sunde said the following on 9/2/2005 7:09 AM:

Is there a way to detect if the reason an onUnload()
handler was called originated from the user explicitly
refreshed the page(s)?
No.

Ie. pressed "Ctrl-R", "F5" or klicked the refresh button
in the toolbar or the context menu?


No.


<snipped />

Now, that was encouraging... ;-)


Glad I could be of help :)
Ok... I drop that path then, and consentrate on the serverside.
That's the best place to handle it.
Thanks for saving me a dead-end journey.


Welcome.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Sep 2 '05 #4

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

Similar topics

2
3441
by: DonO | last post by:
I have a jsp page that updates information as a user enters form fields. It's part of an AP system where a user can select a category, and then it refreshes the page, pulling relative info into other form fields. The issue we have is that closing the window with the closer does not clear out buffered info. We have a "close" button that will do this. I tried doing an "onunload" to call the same function as the close button, but since...
10
7860
by: Udi Zisser | last post by:
Hello, any idea why this does not work? or how do i get this thing to work? <BASE HREF="http://localhost/thedude/"> <META HTTP-EQUIV="Refresh" CONTENT="0; URL=redirect.html"> I'm adding the <base> tag to the content of an existing html that contains a redirect meta tag.
1
3537
by: hqdtech | last post by:
how to refresh webform from other webform I have 2 webform, i want if webform A was close then webform B wil refresh. And the problem second: how to catch packet on the network in C#. thanks
2
1898
by: Peter Oliphant | last post by:
I now have graphics being drawn in the Paint event of my form (yeah, and it's very cool). Problem was that it only updated any changes to these graphics when Paint was called. So, I then made it so the Refresh() method of the form was called for each graphic object. In this case it drew just fine, but Paint was being called so often I lost control of the form (e.g., trying to close the form using the close 'x' in upper right corner...
79
3797
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the relevant name owner? If I make a whisky and call it "Jack Daniels", I most probably will have some serious legal problems. "Mozilla" partially appeared because NCSA stopped them from using "Mosaic" in the UA string. Is it some different...
2
1725
by: 440gtx | last post by:
I have a class that maintains a static std::list of its instances. Thus, due to the order of constructors ambiguity of itself and std::list, it cannot be safely instantiated until after main is called. What I would like to do is put in an assert if it is instantiated too early, but unsure how to detect this case. Or perhaps there is a better design for instance tracking?
1
2413
by: killygolaman | last post by:
Hi Guys, Have been looking at this for a while and not sure if there is a solution but hopefully someone can point me in the right direction: The problem is essential I want to undo an update if the user unloads a page but not if they just refresh the page. Detail: I have 2 asp pages. Page 1 solicits some information and updates the database. This information is then posted to Page 2, where further details are entered and a final...
5
2426
by: tshad | last post by:
I have an interface I am using to get access to some of the objects on my form: a textbox (Status) and my statusbar (StatusBar). In my class, which is actually in another class from my form I have the following: public interface IStatusDisplay { string Status { get; set; } string StatusBar { get; set; } }
0
9645
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...
0
10152
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
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
9950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7500
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
5381
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.