codedance/jquery.AreYouSure — pull request #35 by lfjeff (2014-03-13 23:31:03+00:00)
Title: Added support for Apple mobile devices with a broken 'beforeunload' hand...

I could not find anyone who had an "Are You Sure" module that works with Apple mobile devices (which have a broken 'beforeunload' handler) so I modified yours.

My modifications will intercept clicks on any outgoing links and then display a confirmation message if anything has changed. Because we cannot use 'beforeunload', it will not stop a refresh or back button. However, it should prevent a page exit if an external link is clicked.

I also added a few enhancements:
- added support for jquery.validate
- added optional "doubleConfirm" option (because the Javascript alert() can be confusing and many users will hit automatically hit "OK" instead of "Cancel")
- added option to set focus on the submit button after alert is displayed (so the user can more easily click "Submit" to save their data)