javascript alert refresh page code example
Example 1: javascript before reload page alert
<script type="text/javascript">
window.onbeforeunload = function () {
return 'Are you really want to perform the action?';
}
</script>
Example 2: javascript alert on refresh
window.onbeforeunload = function() {
return "Data will be lost if you leave the page, are you sure?";
};