I am trying to do this in html and js but not refresh or reload just trigger when its getting closed. I used functions like onbeforeunload,unload but they didnt work.
sample image 
            Asked
            
        
        
            Active
            
        
            Viewed 379 times
        
    0
            
            
        - 
                    Possible duplicate of [Is it possible to display a custom message in the beforeunload popup?](http://stackoverflow.com/questions/38879742/is-it-possible-to-display-a-custom-message-in-the-beforeunload-popup) – Dekel Sep 01 '16 at 11:49
 
1 Answers
1
            
            
        Try This with jQuery:
$(window).bind('beforeunload', function(){
  return 'Are you sure you want to leave?';
});
Or with javascript
window.onbeforeunload = function(){
  return 'Are you sure you want to leave?';
};
        Amy
        
- 4,034
 - 1
 - 20
 - 34