473,569 Members | 2,422 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event handler fires multiple events after page reload

Hi all,
i have a js application with several event handlers which i manage via
prototype .bindAsEventLis tener.

On normal page navigation ( link navigation ) i finish all events
handlers (onUnload) if a new page should be loaded and everything
works fine: All event handlers are finished and the new page works
fine.

However, if i do a browser "reload" the events a fired twice after it.
I did some debugging and i am sure that the onunload functions are
called with the browser "reload": But the event handlers seem to exist
anyway after it.

So what i wanted to know:

- Is this a common problem ( double fired events )?
- Is there a pattern to handle this. I tried to put all onunload stuff
in the .dispose() functions but have the same problems
- Can i finsish all event handlers on startup (so that no event
handlers exists if i load a new page)
Thanks for any help,
Chris

Mar 9 '07 #1
1 2721
On Fri, 09 Mar 2007 15:33:32 +0100, Christian Sengstock
<cs********@gma il.comwrote:
Hi all,
i have a js application with several event handlers which i manage via
prototype .bindAsEventLis tener.

On normal page navigation ( link navigation ) i finish all events
handlers (onUnload) if a new page should be loaded and everything
works fine: All event handlers are finished and the new page works
fine.

However, if i do a browser "reload" the events a fired twice after it.
I did some debugging and i am sure that the onunload functions are
called with the browser "reload": But the event handlers seem to exist
anyway after it.

So what i wanted to know:

- Is this a common problem ( double fired events )?
- Is there a pattern to handle this. I tried to put all onunload stuff
in the .dispose() functions but have the same problems
- Can i finsish all event handlers on startup (so that no event
handlers exists if i load a new page)
Thanks for any help,
Chris
You may want to look into event bubbling. Most events are cancellable, to
prevent them from bubbling up the dom hierarchy.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Mar 11 '07 #2

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

Similar topics

10
3573
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script language="JavaScript" type="text/javascript"> function show(that) { if (box.style.visibility=='hidden') { that.style.visibility = 'visible'}; }
6
5317
by: Tom | last post by:
Hi, In the following code I have reproduced a problem in IE that is extremely annoying for my application. <html> <head> <script type="text/javascript">
8
1785
by: Paul | last post by:
Hi, In a class i built, i fire an event when a field changes. In a webform that has an instance of the class, the event (from the class) is fired and the code is executed. However, my webpage does not reload (postback) after the event fires. How do i get the webform to postback when the event fires (after the code in the event is done...
3
1822
by: bill | last post by:
I am using VS2005 to build a web form dynamically. I'm using AddHandler to connect a custom event handler to the TextChanged event of dynamically added textbox controls. Data entered in the dynamically added textbox controls is saved to a database in the custom event handler. The custom event handler fires when the page posts back. I...
6
8761
by: Joseph Geretz | last post by:
I'm porting a C# Outlook Addin originally engineered as a COM Addin over to use VSTO. I've gotten this to the point where my VSTO Addin installs its Menu items and Toolbar buttons when Outlook launches. I've wired up my event handler to each Menu item and toolbar button. (I use the same Event handler and I use the Tag property which is...
1
5347
by: Jeremy Martin | last post by:
Hi, I am currently learning c# so be gentle :) I am converting a Delphi.NET website to c# website and I am confused as to how events are handled. 2 Situations. 1. A component on a webusercontrol fires a postback event. On postback
0
1895
by: John | last post by:
I am loading my controls dynamically into my asp.net page. When I click on a button on one of those user controls then page reloads and I need to reload the page based on what has happened in the button click. Problem is that the button click is the last thing to fire so I need to reload the page a second time to update the controls based on...
2
3902
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite well, so at times it is tempting just to port parts of it over mostly as-is. In fact, one MSDN article I read suggested using straight HTML wherever...
0
7703
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...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
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...
1
7678
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...
0
6286
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...
1
5514
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...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
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
0
944
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...

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.