Many ideas, technologies, and additions have entered the web field recently for the purpose of serving the user experience in web applications, such as support for notifications, availability of an icon on the desktop, the availability of control over the API and working with a full screen, and the most important elements and pillars of these technologies and additions Service Worker and the application work without connection in the network And caching and other what contributed to the success of the user experience for these applications.
The concept of Service Worker script is executed in the background of a web project (website or application), not linked to a specific page. Responsible for the events that occur in the project, such as the network requests issued by the page he is responsible for and the responses to these requests. He has several goals, the most important of which is to allow the use of the application with the network, or its interruption or slowdown. If we assume a person uses a site and is connected to the network, and while browsing the site, his connection to the network is disconnected, but wants to return to the previous page, then the previous page will not open and a screen will appear informing him of his disconnection from the network, but if that site has a Service Worker, this will not happen, but the previous page or At least part of it.
It is nice to mention that any website can own and operate a Service Worker taking advantage of its wonderful advantages, but in the case of PWA progressive web applications it must have it and be registered and effective it is a condition of its work.