Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop window unloading?

Tags:

javascript

when user click a another link or refresh the page, the window will unload, how to prevent/confirm it?

like image 830
lovespring Avatar asked Dec 29 '22 06:12

lovespring


1 Answers

From here http://bytes.com/topic/javascript/insights/825556-using-onbeforeunload-javascript-event

<script type="text/javascript">
     window.onbeforeunload = function(){ return 'Your Returned String Goes Here';}
</script>
like image 52
Daniel A. White Avatar answered Dec 31 '22 20:12

Daniel A. White