Add beforeunload
This commit is contained in:
@@ -20,6 +20,15 @@ export function preLoadCheck(){
|
||||
localStorage.setItem('mainpage', searchParams.get('mainpage'));
|
||||
}
|
||||
|
||||
if(isWeb) {
|
||||
//Add beforeunload event listener to prevent the user from leaving the page
|
||||
window.addEventListener('beforeunload', (e) => {
|
||||
e.preventDefault()
|
||||
//legacy browser
|
||||
e.returnValue = true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// Redirect to the main page if the user has not visited the main page
|
||||
if(localStorage.getItem('mainpage') !== 'visited') {
|
||||
|
||||
Reference in New Issue
Block a user