Issue metadata
Sign in to add a comment
|
event beforeunload is not working with my chrome version 67
Reported by
victorhu...@gmail.com,
Jun 5 2018
|
||||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36
Steps to reproduce the problem:
$(window).off('beforeunload').on('beforeunload', removeDeviceFromStorage());
function removeDeviceFromStorage () {
console.log('>>>removeDeviceFromStorage was called!!!');
localStorage.removeItem("DEVICE_CREATED");
}
What is the expected behavior?
remove the item from localStorage before refresh a tab
What went wrong?
the item was never removed because the event listener never worked
Did this work before? Yes 65
Chrome version: 67.0.3396.62 Channel: stable
OS Version: 10.0
Flash Version:
The web app is running in salesforce
,
Jun 5 2018
,
Jun 5 2018
Your code is incorrect: it invokes removeDeviceFromStorage immediately instead of specifying a function reference. Remove () like this: .....on('beforeunload', removeDeviceFromStorage);
,
Jun 5 2018
victorhugo.lunar@ - 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...!!
,
Jun 5 2018
I remove the () but it is still not working...
$(window).off('beforeunload').on('beforeunload', removeDeviceFromStorage);
function removeDeviceFromStorage () {
console.log('>>>removeDeviceFromStorage was called!!!');
localStorage.removeItem("DEVICE_CREATED");
}
,
Jun 5 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
,
Jun 6 2018
Tried testing the issue on Win-10 using chrome reported version #67.0.3396.62 and latest canary #69.0.3450.0.
Attached a screen shot for reference.
Following are the steps followed to reproduce the issue.
------------
1. Opened the following code in console:
$(window).off('beforeunload').on('beforeunload', removeDeviceFromStorage);
function removeDeviceFromStorage () {
console.log('>>>removeDeviceFromStorage was called!!!');
localStorage.removeItem("DEVICE_CREATED");
}
2. Got an uncaught exception as follows:
VM60:1 Uncaught TypeError: Cannot read property 'off' of undefined
at <anonymous>:1:10
victorhugo.lunar@ - 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...!!
,
Jul 17
We've landed a fix for beforeunload in cross-site iframes in issue 853021 . It should be working again in 69.0.3492.0, and we plan to merge the fix to Chrome 68. |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by tkent@chromium.org
, Jun 5 2018