only check reloading text in body > h1
parent
f7cfa87df7
commit
7f901270da
|
|
@ -1,7 +1,7 @@
|
||||||
window.addEventListener('beforeunload', (event) => {
|
window.addEventListener('beforeunload',e=> {
|
||||||
if (document.body.innerHTML.includes('Reloading...')) {
|
let h1 = document.querySelector('body > h1')
|
||||||
return;
|
if (!h1 || 'Reloading...' !== h1.innerText) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.returnValue = 'Are you sure you want to leave Webui?';
|
||||||
}
|
}
|
||||||
|
});
|
||||||
event.returnValue = 'Are you sure you want to leave Webui?';
|
|
||||||
});
|
|
||||||
Loading…
Reference in New Issue