SharePoint Online service worker functionality

Rolands Strakis 121 Reputation points
2021-06-28T10:41:14.65+00:00

Hello,

I'd like to understand what SharePoint Online service worker does, and is it possible to register your own service workers?

Why I'm asking this - I've registered service worker with scope https://tenant.sharepoint.com/sites/, so that I can intercept events from any site collection in my tenant. But I've noticed that SharePoint Online also has service worker registered in root scope - odspserviceworkerproxy.aspx.

If I register my service worker with more specific scope, then only my service worker will receive all the requests, say, from site https://tenant.sharepoint.com/sites/xxx.

So, what does SharePoint Online service worker do, so I can understand, what will be the impact of adding my service worker?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,622 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rolands Strakis 121 Reputation points
    2021-07-07T11:33:43.783+00:00

    So, after talking to Microsoft support, it seems that this service worker is used for SharePoint Online partial offline availability. I've checked and yes, when that service worker is disabled, then I don't have page cached to access offline. But when it's enabled, I do get some page offline.
    It is not perfect now, but could be updated over the time, as they are constantly updating it. Last update was 10 days ago (you can see by the logs generated by odspserviceworkerproxy.aspx.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Allen Xu_MSFT 13,776 Reputation points
    2021-06-29T06:06:11.62+00:00

    Hi @Rolands Strakis ,

    As per my knowledge, we can register service workers to SharePoint Online sites so that the service workers can intercept all requests from the current website and make judgments (you need to code the corresponding judgment program), and if you need to initiate a request to the server, it will be transferred to the server. If the cache can be used directly, it will directly return to the cache and no longer transfer it to the server.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.