Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Able to install ServiceWorker even when system is offline. #2608

Closed
DexterWoo opened this issue Jul 20, 2022 · 6 comments
Closed

Able to install ServiceWorker even when system is offline. #2608

DexterWoo opened this issue Jul 20, 2022 · 6 comments
Assignees
Labels
feature request feature request status-circle back Check back after requesting general information. tracked We are tracking this work internally.

Comments

@DexterWoo
Copy link

DexterWoo commented Jul 20, 2022

we recently are working on an app.
it's composed of webview2 + a PWA app.
we would like to preload the PWA with WebResourceRequested event.
however, it will not work when the system is offline.
it would be nice to be able to preload the PWA even when the system is offline.

Ideally, we would like to have something like this.

App 1st launch, in WebResourceRequested we'll provide the first version of the PWA app.
the following version updates will be handled by ServiceWorker's logic.

AB#40545851

@DexterWoo DexterWoo added the feature request feature request label Jul 20, 2022
@victorthoang victorthoang added the tracked We are tracking this work internally. label Jul 20, 2022
@victorthoang
Copy link

Thanks for the feedback! We've added this as a scenario on our backlog!

@aluhrs13 aluhrs13 self-assigned this Aug 24, 2022
@aluhrs13
Copy link
Contributor

@DexterWoo - Can you expand on where the PWA files are located if the devices is offline? If the files are all local you could look at using SetVirtualHostNameToFolderMapping to make them available to the WV2.

@DexterWoo
Copy link
Author

we are thinking about everything being served by the service-worker instead, SetVirtualHostNameToFolderMapping is not quite a good option for us cause it will diverge into 2 split flows.

@aluhrs13
Copy link
Contributor

What would the two flows be? You could use SetVirtualHostNameToFolderMapping in the 1st launch case just like you were expecting to use WebResourceRequested.

@DexterWoo
Copy link
Author

What would the two flows be? You could use SetVirtualHostNameToFolderMapping in the 1st launch case just like you were expecting to use WebResourceRequested.

we would need to detect if the service-worker was installed success fully and diverge into 2 flows.

if(!swinstalled)
{
SetVirtualHostNameToFolderMapping(xxx);
}
else
{
WebResourceRequested();// add additional headers into the requests
}

@aluhrs13
Copy link
Contributor

@DexterWoo - We've added an API AddWebResourceRequestedFilterWithRequestSourceKinds method that allows you to pass a COREWEBVIEW2_WEB_RESOURCE_REQUEST_SOURCE_KINDS of COREWEBVIEW2_WEB_RESOURCE_REQUEST_SOURCE_KINDS_SERVICE_WORKER to intercept requests from the service worker.

https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes?tabs=win32cpp#experimental-features-8

Let me know if this doesn't meet your need and why, otherwise I'll close this in ~7 days.

@aluhrs13 aluhrs13 added the status-circle back Check back after requesting general information. label Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request status-circle back Check back after requesting general information. tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

3 participants