codedance / jquery.AreYouSure

A light-weight jQuery "dirty forms" Plugin - it monitors html forms and alerts users to unsaved changes if they attempt to close the browser or navigate away from the page. (Are you sure?)
507 stars 145 forks source link

Safari 9.1.1: No prompt after first refresh #112

Open RandomByte opened 8 years ago

RandomByte commented 8 years ago

Using the latest Safari, the user only gets prompted on the first refresh with unsaved changes. Any succeeding refreshes with unsaved form changes do not lead to a prompt.

I don't use this plugin, but see that it runs into the same issues I do with my (very similar) implementation. So maybe you guys have an idea.

Steps to reproduce

Chrome 9.1.1 on Mac OS X 10.11.5 (El Capitan)

  1. Open the Demo Page from readme
  2. Make a change in any form (e.g. change the coffee dropdown in the first form)
  3. Reload the page
    -> "Are you sure you want to leave this page?" dialog appears
  4. Confirm the dialog with "Leave Page"
  5. Make another change
  6. Reload the page
    => No dialog appears and the page gets reloaded

I suspect that this might be some kind of security measure introduced by Safari. In Chrome, all the succeeding dialogs have a little checkbox saying "Prevent this page from creating additional dialogs". Maybe the Safari developers decided to ditch any additional dialogs without asking the user (they do something similar with popup blocking).

In the latest release notes they only mention that they now use a generic string to prompt the user rather than the custom one supplied by the application.

radeknovis commented 8 years ago

I'm facing the same issue. Using beta Safari Version 10.0 (11602.1.32.7)

XCame commented 8 years ago

Same behavior using Safari Version 9.1.2 (11601.7.7) on El Capitan 10.11.6 (15G31)

missbruni commented 8 years ago

Same problem here

XCame commented 8 years ago

Seems to be a Safari Bug. Same Problem here on Stack Overflow without a relation to AreYouSure http://stackoverflow.com/questions/37268874/beforeunload-not-working-in-safari-9-1-after-the-page-reloads-on-clicking-leave