Handling of unload events on HTML should be a preference




Event Handling
18 years ago
2 years ago


(Reporter: Axel Hecht, Unassigned)



Firefox Tracking Flags

(Not tracked)




18 years ago
There is a very bad habit of pages redirecting to commercials via onunload event
handlers. Some even do traps without a good chance to exit.
Making handling this event an option, and exposing this as a preference gives
user more control over the content they see.

I second Axel here. onload and onabort (not implemented yet, the possibility 
of abuse is one of the factors), maybe also onerror, should have some kind of 
pref to control them. However, I do not think this is critical for the first 
release (after all we are used to them in NN 4.x). I would really like to have 
this in NN 6.1 though.

This bug has been marked "future" because the original netscape engineer working 
on this is over-burdened. If you feel this is an error, that you or another
known resource will be working on this bug,or if it blocks your work in some way 
-- please attach your concern to the bug for reconsideration.
Target Milestone: --- → Future

Comment 2

18 years ago
I have been moving this around in my head, and found an easy solution. And I 
think it's even better. I added a switch to the view menu, which will toggle,
like the taskbars. It will add or remove a eventlistener, so you can change the
behaviour per window. I like this ;-).
Before doing a real patch, I have a few questions on how to proceed:

1.) I added the menu to navigatorOverlay.xul, to the View menu, just below the
character coding. I thought document specific handling would fit there.
2.) I need some js functions. Where should they go? I consider them to be 
navigator only, so navigator.js?
3.) I add the eventlistener to the xul document (I think), is this likely to
break stuff?


Code snipplet:
function eventToNirvana(aEvent){
function registerSwallow(aEventName){
  var mnu = document.getElementById('viewEatUnload');
  if (mnu) {
} else {dump("failure");};
	<broadcaster id="cmd_eatunload" class="menuitem-iconic" type="checkbox"
oncommand="registerSwallow('unload');" checked="false"/>


      <menu id = "charsetMenu" />
      <menu value="Eat DOMEvents"><menupopup>
<menuitem id="viewEatUnload" value="unload" observes="cmd_eatunload"/>

Comment 3

18 years ago
Updating QA Contact.
QA Contact: janc → lorca
Reassigning QA Contact for all open and unverified bugs previously under Lorca's
care to Gerardo as per phone conversation this morning.
QA Contact: lorca → gerardok

Comment 5

17 years ago
QA contact updated
QA Contact: gerardok → madhur


16 years ago
QA Contact: madhur → rakeshmishra


15 years ago
QA Contact: rakeshmishra → trix

Comment 6

15 years ago
Assignee: joki → saari
QA Contact: trix → ian
Assignee: saari → nobody
QA Contact: ian → events

Comment 7

7 years ago
Is this still an issue?

I only see problem 
Bug 560767 Comment 6 - (Don't allow redirects in onbeforeunload)

Can we WFM this.
See Also: → bug 560767
You need to log in before you can comment on or make changes to this bug.