function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SimbaSimba 

Give Warning Message before closing this window or changing tab

I am using Visualforce page, for entry. I would like to prompt the user with a warning message before they close this window (give them a second chance).
 
I tried adding a javascript to make a call to a method, which will prompt the user. (window.onbeforeunload, window.onunload). But none of that worked. It seems like Salesforce changes the script for these events back to the default one.
 
Please let me know how can I give a warning message adn give another chance to the user before closing this window.
 
Thanks
 
Regards..
TehNrdTehNrd
I'm not sure this is possible as the close action of a browser is not related to the code in a page.