Skip to content

Commit

Permalink
feat: Add "Sure you want to leave?" alert
Browse files Browse the repository at this point in the history
  • Loading branch information
NriotHrreion committed Jun 6, 2024
1 parent 960de99 commit 7353d3e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ const App: React.FC = () => {
e.preventDefault();
});

window.addEventListener("beforeunload", (e) => {
e.preventDefault();
alert("确定要关闭此页面吗?");
e.returnValue = "";
});

// To prevent some part of the page being covered by the bottom toolbar of mobile browsers
if(Utils.isMobile()) {
const { height } = Utils.getWindowConfig();
Expand Down

1 comment on commit 7353d3e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.