filips123 / PWAsForFirefox

A tool to install, manage and use Progressive Web Apps (PWAs) in Mozilla Firefox
https://pwasforfirefox.filips.si
Mozilla Public License 2.0
2.16k stars 50 forks source link

Add an option to open app to previous state #462

Open LSeelig opened 6 months ago

LSeelig commented 6 months ago

Problem Description

I created a PWA for a textbook for a course I am taking https://rust-book.cs.brown.edu/. One of the reasons I did this was because simply bookmarking it in my browser meant I had to hunt through history to return to the page I was on.

I thought able to restore the PWA to the previous session whenever I opened it would achieve this effect.

There are some issues with the Firefox feature that achieves this. From my testing, the problems occur because Firefox doesn't restore the old window in place of the new window, but instead opens the previously closed tabs and windows along with the new tab created by opening the app, and depending on how I have set tabs and windows to open, this leads to failing to launch the PWA, multiple tabs glitching into one window (without tab mode), or multiple windows opening.

Changing the homepage didn't work because it seems to be overridden by firefoxpwa, which always launches the app's home page as specified in settings/manifest.

Proposed Solution

There should be a FirefoxPWA about:config/settings page option to open to the previous session instead of the app's specified homepage. This should restore the previous session's windows. If that is unrealistic, it should just restore the last page to be closed in reverse order of history.

Additional Information

filips123 commented 6 months ago

From my testing, the problems occur because Firefox doesn't restore the old window in place of the new window, but instead opens the previously closed tabs and windows

Which option do you have set for the "When opening a link that should normally open in a new window or tab" preference in the PWA settings? Can you check if changing it to other options in the PWA settings fixes this issue?


Yeah, there are some problems with the session (re)store in PWAs, that's why it's disabled by default. Unfortunately, implementing full session support is quite hard, so it probably won't happen any time soon. This is tracked in issue #256.

But I will check if it's possible to at least add an option to open the last page URL when launching PWA.

LSeelig commented 6 months ago

Which option do you have set for the "When opening a link that should normally open in a new window or tab" preference in the PWA settings? Can you check if changing it to other options in the PWA settings fixes this issue?

It causes different behavior. Each behavior causes different restoring, though I am no longer sure if these launch failures are related to enabling firefox's session restores as I have observed it even when it is disabled.