Monday, May 20, 2024
97
rated 0 times [  104] [ 7]  / answers: 1 / hits: 40014  / 8 Years ago, mon, june 13, 2016, 12:00:00

I have custom message to onbeforeunload event and was working well but I noticed today that it's not showing my message anymore. Instead it shows changes you made may not be saved



window.onbeforeunload = function () {

return 'Custom message'
}


can anyone please let me know how to fix it?


More From » google-chrome

 Answers
3

To avoid scamming, chromium and hence chrome have decided to remove the ability to set a custom message in the onbeforeunload dialog.



See this bug report from the 18th of February, 2016.




onbeforeunload dialogs are used for two things on the Modern Web:

1. Preventing users from inadvertently losing data.

2. Scamming users.



In an attempt to restrict their use for the latter while not stopping the former, we are going to not display the string provided by the webpage. Instead, we are going to use a generic string.



Firefox already does this[...]



[#61795] Friday, June 10, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jackeline

Total Points: 245
Total Questions: 92
Total Answers: 100

Location: Ukraine
Member since Sun, Dec 13, 2020
4 Years ago
;