Skip to content

Commit

Permalink
feat: test beforeunload compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Leoglme committed Feb 18, 2024
1 parent 0b7d620 commit a09cfbb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions public/mon-script.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
window.addEventListener('popstate', () => {
confirmFirst('popstate')
})
window.addEventListener('beforeunload', () => {
confirmFirst('beforeunload')
})
// window.addEventListener('popstate', () => {
// confirmFirst('popstate')
// })
// window.addEventListener('beforeunload', () => {
// confirmFirst('beforeunload')
// })

window.addEventListener('pagehide ', () => {
window.addEventListener('pagehide', () => {
confirmFirst('pagehide')

})

confirm('v3')
confirm('v4')

function confirmFirst(eventName) {
if(confirm("Leave the page?" + eventName)){
Expand Down

0 comments on commit a09cfbb

Please sign in to comment.