navigator.sendBeacon() not sent when browser is closed
Reported by
rhert...@gmail.com,
Mar 20 2018
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36 Steps to reproduce the problem: 1. Open multiple tabs 2. Close a tab that sends a navigator.sendBeacon in beforeunload 3. beacon is sent correctly 4. Close the last tab (causing the last open window to close) that sends a navigator.sendBeacon in beforeunload 5. beacon is NOT sent. What is the expected behavior? beacon is send in step 5 or when browser opens again What went wrong? When the browser is closed the beacon is never sent Did this work before? N/A Does this work in other browsers? Yes Chrome version: 65.0.3325.162 Channel: stable OS Version: 10.0 Flash Version: Shockwave Flash 29.0 r0
,
Mar 21 2018
,
Mar 21 2018
,
Mar 22 2018
rhertogh@ - Thanks for filing the issue...!! Could you please provide a sample test file/url to test the issue from TE-end. This will help us in triaging the issue further. Thanks...!!
,
Mar 22 2018
,
Mar 22 2018
I'm no longer sure if this a bug. When working on a sample I was thinking about the security implication that sending a beacon when the browser has been closed would have so I digged a little deeper in the sendBeacon definition and found some contradictory definitions. From https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon "By using the sendBeacon() method, the data is transmitted asynchronously to the web server when the User Agent has an opportunity to do so" https://www.w3.org/TR/beacon/ "The sendBeacon method does not provide special handling for offline storage or delivery. A beacon request is like any other request and may be combined with [SERVICE-WORKERS] to provide offline functionality where necessary." So it looks like the statement on the mozilla website "transmitted asynchronously ... WHEN the User Agent has an opportunity to do so" should be "transmitted asynchronously ... IF the User Agent has an opportunity to do so" Following the w3 specification the behavior described in this issue would not be a bug.
,
Mar 22 2018
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 23 2018
Thank you for reporting. I think that our current policy is that closing the browser cancels keepalive requests, and the feature is working as intended.
,
Mar 23 2018
Note: Service worker is also terminated when the browser is closed. |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by rhert...@gmail.com
, Mar 20 2018