I want to detect if user tries to refresh the page, and my code is
window.onbeforeunload = function(e) {
var dialogText = 'custom text.'
e.returnValue = dialogText
return dialogText
}
however, when user click the browser's refresh button, it always shows
from mozilla's specification:
Starting with Firefox 4, Chrome 51, Opera 38 and Safari 9.1, a generic string not under the control of the webpage will be shown instead of the returned string.
Is it possible to have custom text in the alert? seems mission impossible?