How to show custom message in window.onbeforeunload
? By default, it is showing as attached image. I need to show Don't Refresh instead of Cancel, and Refresh Anyway instead of Leave. I have tried but failed.
Swal.fire({
title: 'Are you sure?',
html: 'You are about to save a session named',
icon: 'warning',
showCancelButton: true,
timer: 999999,
didOpen: () => {
Swal.showLoading()
const b = Swal.getHtmlContainer().querySelector('b')
timerInterval = setInterval(() => {
b.textContent = Swal.getTimerLeft()
}, 100)
},
willClose: () => {
clearInterval(timerInterval)
},
timerProgressBar: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Save',
cancelButtonText: 'Continue edit'
}).then((result) => {
if (result.isConfirmed) {
}
event.preventDefault();
});
};