I am using the following code snippet to trigger an alert before page closes but Chrome seems to ignore the message and displays its default message "Do you want to leave this site? Changes you made might not be saved". How can I make chrome show my message instead of the default one?
window.onbeforeunload = function(e) {
e.returnValue = "A search is in progress, do you really want to stop the search and close the tab?";
return "A search is in progress, do you really want to stop the search and close the tab?";
}