microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.81k stars 29.12k forks source link

[PWA] Add an offline fallback for index.html #135781

Closed digitarald closed 2 years ago

digitarald commented 3 years ago

To hit the PWA install criteria, all VS Code is missing is a SW that handles index.html. When we check that off, Edge and Chrome will show the "Install" banner.

As making all of vscode.dev offline capable is a bigger item, an intermediate step is serving an offline fallback from a SW for index.html. More details in https://web.dev/offline-fallback-page/

@mattbierner, as on origin can only have one SW attached, will this have to integrate with the existing webview/browser/pre/service-worker.js? I know github.dev had SW issues in Firefox but could not get Chrome to load a SW so don't fully understand when it is initialized.

cc @bamurtaugh @bpasero

bpasero commented 3 years ago

This is quite bizarre to me and I would suggest to connect with browser vendors on alternatives here.

Maybe Miguel could design some kind of offline page that we then serve from the SW if there is no connection.

//cc @isidorn @joaomoreno

digitarald commented 3 years ago

@bpasero by bizarre, do you mean that serving an offline fallback for index.html fulfills the PWA install criteria, while the mechanism itself doesn't add much value for desktop users? I agree with the notion and the criteria have been a more contentious part of PWA's history. I am not convinced that adding such a basic SW is a multiplier for a desktop app experience.

But Chrome is on the offline fallback bandwagon, as https://web.dev/offline-fallback-page/ shows, and Edge's pwabuilder also suggests offline fallback as a basic SW: https://www.pwabuilder.com/testing?site=https://vscode.dev . @thejohnjansen and @likuba also advised on it.

likuba commented 3 years ago

Yup - this recommendation/criteria from browser vendors is mostly about avoiding a "404" type page (which we think is confusing for users who have installed an app and no longer think of it as a website). Of course a rich offline experience is likely going to provide more value than just a "you are offline" page, but that's also an incremental improvement you can choose to make over time. There has definitely been debate about what the install criteria should be - happy to take feedback there as well. if you have it

Adding some sort of SW/minimal offline experience (along with a web app manifest and serving over https) is what you need to provide for users to get the address bar to prompt install of the web app.

bpasero commented 3 years ago

It is bizarre because that makes it sound as if the only advantage of PWA is to have offline capability, whereas for VS Code that is not even coming close. PWA helps to use VS Code properly - almost like a desktop app - and I think offline support is not our main goal for offering PWA.

digitarald commented 3 years ago

I think offline support is not our main goal for offering PWA.

Agreed. To reframe, "offline usage" is not a goal for this issue but graceful fallback for intermittent connectivity and of course allowing Chrome users to install the PWA by hitting the criteria.

likuba commented 3 years ago

*Chrome and Edge :D

But yes - that's exactly how to think about it.

joaomoreno commented 2 years ago

Good to close!