Skip to content

Commit

Permalink
Do not intercept reload if app has FS Access
Browse files Browse the repository at this point in the history
Fixes #673
  • Loading branch information
Jaifroid committed Dec 1, 2024
1 parent 8cebc6a commit 6a4934b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion www/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ window.onerror = function (msg, url, line, col, error) {

// Set a beforeUnload handler to prevent app reloads without confirmation if a ZIM file is loaded
window.addEventListener('beforeunload', function (event) {
if (params.interceptBeforeUnload && !params.useOPFS && appstate && appstate.selectedArchive && params.appCache && !/Electron/.test(params.appType)) {
if (params.interceptBeforeUnload && !params.useOPFS && params.appCache && !/UWP|Electron/.test(params.appType)) {
if (!appstate.selectedArchive) return; // No need to intercept if no archive is loaded
if (params.pickedFile || params.pickedFolder) return; // No need to intercept if we have FS access to a file or folder
var confirmationMessage = 'Warning: you may have to reload the ZIM archive if you leave this page!';
event.preventDefault();
// Included for legacy support, e.g. Chrome/Edge < 119
Expand Down

0 comments on commit 6a4934b

Please sign in to comment.