Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Server-Side Enterprise Development with Angular

You're reading from   Server-Side Enterprise Development with Angular Use Angular Universal to pre-render your web pages, improving SEO and application UX

Arrow left icon
Product type Book
Published in Nov 2018
Publisher
ISBN-13 9781789806267
Pages 142 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Bram Borggreve Bram Borggreve
Author Profile Icon Bram Borggreve
Bram Borggreve
Arrow right icon
View More author details
Toc

Testing the Service Worker

In this section, we will see how we can test our service worker.

Checking Where the Data Comes From

Using the Chrome Developer Tools, it's easy to see where a particular resource is being retrieved from.

Using the Network tab in Chrome Developer Tools, you can see what files are being retrieved, where the data comes from, and how long it took the browser to fetch those resources. This following screenshot shows a normal page request, where each of the files are downloaded from the web server:

Figure 3.1: A normal page request
Figure 3.1: A normal page request

In the following screenshot, you can see in the Size column that the data is retrieved from the service worker. This means that it did not make a request to the network to fetch those items; instead, it got it from the browser cache:

Figure 3.2: A page request with service worker enabled
Figure 3.2: A page request with service worker enabled

Enabling Offline Mode

It's in the nature of a web browser to be online...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime