service worker is marked deleted after redirection to another app within same domain

16 views
Skip to first unread message

Mitesh Jain

unread,
Mar 5, 2019, 10:44:39 AM3/5/19
to service-worker-discuss
Hi,

I have posted this question on stack over flow last week but have not got any response so trying to reach out here.


TLDR;

S/W is registered on www.domain.com/myapp and is successfully installed and running.

After user is redirected to www.domain.com/otherapp it is marked deleted but I am not able to receive any push events. 

If I dont address the scope, the s/w is marked redundant right away once user leaves myapp.

So I set the scope and same in the service  worker header response.
 
I dont have root app control (for now) so I am registering my s/w at /myapp in following mannrers
  1. navigator.serviceWorker.register('/myapp/js/serviceWorker.js')
  2. navigator.serviceWorker.register('/myapp/js/serviceWorker.js', {scope: '/'})
  3. navigator.serviceWorker.register('/myapp/js/serviceWorker.js', {scope: '/otherapp'})
I have also made sure the respective scope in the s/w header in the response.

In all the above scenarios the s/w is marked deleted or redundant in case of no scope.

I am not sure if scope is the way to solve this or anything else I am missing.

One thing I have to try as per colleague's recommendation is registering at root level but I dont know if that is possible - 

navigator.serviceWorker.register('/serviceWorker.js');

Please let me know if someone has any lead.

Thank you.

- Mitesh Jain.
Reply all
Reply to author
Forward
0 new messages