WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
REOPENED
219102
[iOS] beforeunload event does not fire in MobileSafari
https://bugs.webkit.org/show_bug.cgi?id=219102
Summary
[iOS] beforeunload event does not fire in MobileSafari
Chris Dumez
Reported
2020-11-18 11:35:14 PST
beforeunload event does not fire in MobileSafari on iOS. This is inconsistent with the HTML specification and with Safari on macOS. It is therefore confusing for Web developers that this event does not fire.
Attachments
Patch
(6.24 KB, patch)
2020-11-18 11:50 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(6.37 KB, patch)
2020-11-18 11:56 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(6.38 KB, patch)
2020-11-18 12:44 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2020-11-18 11:35:24 PST
<
rdar://problem/70550655
>
Chris Dumez
Comment 2
2020-11-18 11:50:45 PST
Created
attachment 414464
[details]
Patch
Geoffrey Garen
Comment 3
2020-11-18 11:54:48 PST
Comment on
attachment 414464
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=414464&action=review
r=me
> Source/WebCore/ChangeLog:9 > + MobileSafari on iOS does implement WKUIDelegate's runJavaScriptAlertPanelWithMessage because
does not
> Source/WebCore/ChangeLog:16 > +
Might be worth mentioning that iOS already fires the unload event, so running an event at this time is not a significant change in policy.
Chris Dumez
Comment 4
2020-11-18 11:56:46 PST
Created
attachment 414466
[details]
Patch
Chris Dumez
Comment 5
2020-11-18 12:44:43 PST
Created
attachment 414470
[details]
Patch
EWS
Comment 6
2020-11-18 13:57:25 PST
Committed
r269983
: <
https://trac.webkit.org/changeset/269983
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 414470
[details]
.
Chris Dumez
Comment 7
2020-12-08 15:54:46 PST
Reverted
r269983
for reason: Seems to have regressed PLT5 Committed
r270560
: <
https://trac.webkit.org/changeset/270560
>
Srinivas
Comment 8
2024-10-27 11:47:38 PDT
I have observed that the beforeunload event is not firing in iOS Safari again, similar to the previous issue reported (
Bug 219102
). This issue persists on iOS 17 and can be reproduced by navigating away from a webpage with a beforeunload handler. It works fine on macOS Safari. Please investigate this recurring problem
Darin Adler
Comment 9
2024-10-27 19:14:21 PDT
Yea that’s expected. We have not yet successfully fixed this bug.
Srinivas
Comment 10
2024-10-28 06:50:06 PDT
It was working before we update iOS 17. Not sure if it was broken as part of iOS 17 changes.
Darin Adler
Comment 11
2024-10-28 14:03:37 PDT
That is surprising since the history above says we didn’t fix it!
Mark
Comment 12
2024-12-13 18:17:19 PST
+1 on this issue. I'm seeing `beforeunload` not getting triggered on iOS 17 and iOS 18 on page refresh. Is this expected? Demonstration:
https://drive.google.com/file/d/1MNp1_HmZQR_2YnRnlOQinKq-RMMOAfOQ/view?usp=sharing
Doesn't seem documented in the [docs](
https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
)
Darin Adler
Comment 13
2024-12-14 12:29:09 PST
Yes, it’s expected. Nobody has fixed this bug yet. The attempt back in 2020 was unsuccessful.
Mark
Comment 14
2024-12-16 10:05:28 PST
Thanks Darin! Is it being actively worked on or not in your plans? If not, what's the alternative here? Can we use `unload` despite advised against it? All we need to do is to close a pop-up on page refresh. This is because if we don't, post-refresh, we can't open a new pop-up on WebKit mobile.
Darin Adler
Comment 15
2024-12-16 10:12:48 PST
I don’t know the answers to those questions
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug