This project is archived and is in readonly mode.

#960 ✓wontfix
Jean-Nicolas Boulay Desjardins

onbeforeunload

Reported by Jean-Nicolas Boulay Desjardins | August 13th, 2010 @ 07:42 PM

It seems that Mootools does not support: onbeforeunload

If I use this, it works:

var warning = true;
    window.onbeforeunload = function() { 
        if (warning) {
            return 'You have made changes on this page that you have not yet confirmed. If you navigate away from this page you will loose your unsaved changes.';
        }
    }

But if I use this, it does not work:

var warning = true;
window.addEvent('beforeunload', function(){ 
    if (warning) {
        return 'You have made changes on this page that you have not yet confirmed. If you navigate away from this page you will loose your unsaved changes.';
    }
});

Comments and changes to this ticket

  • Christoph Pojer

    Christoph Pojer September 3rd, 2010 @ 11:15 AM

    • State changed from “new” to “wontfix”

    MooTools wraps events so they do not return anything. Please use window.onbeforeunload or the native methods addEventListener or attachEvent.

  • mooyah

    mooyah December 28th, 2010 @ 06:27 PM

    Wouldn't the ideal solution involve a mechanism for returning values from event handlers? Having a framework that only works "sometimes" is quite annoying. Other frameworks support these types of events, and I feel that MooTools needs to step it up to support them as well.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages