Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Service Worker Console? & Where is it in Chrome Browser?

I am working on push notifications and came upon an unfamiliar term:

service worker console.

I have read and used the term console log or web console in browser, but I am not familier with the term service worker console, and I didn't find appropriate answer after googling it.

Can anyone explain what is service worker console? How to access it in Google Chrome?

like image 666
Saugat Bhattarai Avatar asked Aug 25 '16 10:08

Saugat Bhattarai


People also ask

What is service worker used for?

Service workers are specialized JavaScript assets that act as proxies between web browsers and web servers. They aim to improve reliability by providing offline access, as well as boost page performance.

How do I console log a service worker?

Get familiar with the Service Workers panel in DevTools #Press `Control+Shift+J` (or `Command+Option+J` on Mac) to open DevTools. Click the Console tab.

How do I find a service worker?

A: From a page on the same origin, go to Developer Tools > Application > Service Workers. You can also use chrome://inspect/#service-workers to find all running service workers. To poke around at the internals (usually only Chromium developers should need this), visit chrome://serviceworker-internals .

What is the use of service worker in react?

A service worker is generated by default when we use the create-react-app to create a new React project. We will find the serviceWorker. js file in the src folder of the project. But the service worker is not functional out of the box; we will have to configure it.


2 Answers

Go to chrome://serviceworker-internals

Choose any service worker and start it if not already started.

Click on Inspect!!

Boom! You have the console there!

like image 160
Dhruv Batheja Avatar answered Oct 13 '22 21:10

Dhruv Batheja


If a page has a service worker, then that service worker's logs show in that page's JavaScript console. You can see the source of a log line on the right-hand side of the log:

log line sources

In the console, there is a select box to select the JavaScript context. This defaults to top (which means "show everything"), but you can select a more specific context for just the service worker:

selecting alternative context

like image 34
jameshfisher Avatar answered Oct 13 '22 20:10

jameshfisher