Reviewed & tested by the community
Project:
onBeforeUnload API
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
4 Mar 2011 at 17:21 UTC
Updated:
14 Aug 2018 at 22:34 UTC
Jump to comment: Most recent
Comments
Comment #1
seanbfuller commentedSorry, forgot to mark as needs review.
Comment #2
seanbfuller commentedI did some more digging into this to resolve some issues regarding the overlay in D7 (see #950736: DirtyForm Port to D7). I couldn't find a consistent way to catch any kind of onunload event for the overlay's iframe. I was able to get close by trying to bind the hashchange.drupal-overlay event, but there was no elegant way to stop overlay from processing the page change. I played around with adding a check in Drupal.overlay.redirect to see if Drupal.onBeforeUnload exists and then adding some sort of call confirm call, but that is obviously a hack to core and also probably not the best way to go about it.
Unless someone with a better understanding of the overlay module has a better idea, it seems that a patch to overlay allowing other modules to register a check that stops overlay from changing the page would be needed.
While looking into this, I also found #655388: Many ways to lose data on form input in the overlay, which mentions dirtyforms and different options for dealing with things this module might be used for.
As it stands, this patch and dirtyforms seems to be working for D7... unless you have the overlay enabled. Not sure of the best next step.
Comment #3
geek-merlinsee #950736-6: DirtyForm Port to D7
Comment #4
jimmyko commentedI am looking for this too... This module won't be continued?
Comment #5
jacob.embree commentedI created a fork here to contain the changes here and whatever other changes I find necessary.