//This is the "Offline copy of pages" service worker//Add this below content to your HTML page, or add the js file to your page at the very top to register service worker if (navigator.serviceWorker.controller) { console.log('[PWA Builder] active service worker found, no need to register') } else { //Register the ServiceWorker navigator.serviceWorker.register('pwabuilder-sw.js', { scope: './' }).then(function(reg) { console.log('Service worker has been registered for scope:'+ reg.scope); }); }//This is the "Offline copy of pages" service worker//Install stage sets up the index page (home page) in the cache and opens a new cache self.addEventListener('install', function(event) { var indexPage = new Request('index.html'); event.waitUntil( fetch(indexPage).then(function(response) { return caches.open('pwabuilder-offline').then(function(cache) { console.log('[PWA Builder] Cached index page during Install'+ response.url); return cache.put(indexPage, response); }); })); });//If any fetch fails, it will look for the request in the cache and serve it from there first self.addEventListener('fetch', function(event) { var updateCache = function(request){ return caches.open('pwabuilder-offline').then(function (cache) { return fetch(request).then(function (response) { console.log('[PWA Builder] add page to offline'+response.url) return cache.put(request, response); }); }); };event.waitUntil(updateCache(event.request));event.respondWith( fetch(event.request).catch(function(error) { console.log( '[PWA Builder] Network request Failed. Serving content from cache: ' + error );//Check to see if you have it in the cache //Return response //If not in the cache, then return error page return caches.open('pwabuilder-offline').then(function (cache) { return cache.match(event.request).then(function (matching) { var report = !matching || matching.status == 404?Promise.reject('no-match'): matching; return report }); }); }) ); })

General Tech

Google Teams Up with Flipkart to Launch Google Home in India

Google has stirred up a buzz among the people in India, ever since its tweet broke the internet last week. The company confirmed that...

WhatsApp Plus – All the Risks that You Should Know about This Fake App

WhatsApp tries to roll out updates frequently and work on their app sincerely to give its users a smooth and satisfying experience. It is...

WhatsApp Introduces Voice Recording Lock Button

Whatsapp is all set to launch some new features and they are rolling out these now in their beta version before launching them. Currently...

Xiaomi Mi Fan Festival is On – Grab Your Deals Now

Xiaomi Mi Fan Festival is live from today on Mi.com and Mi Store. Just like last year, Xiaomi is offering last discounts, coupons and...
Polaris

Soon experience all new Screen Clipping coming with Windows 10 RS5

As we all know that, Microsoft is working continuously on shell modernization. As a part of it, the company is working on a new...
Pixel2

First appearance of Pixel 3 in AOSP before any Official mentioning

Recently there has been an official mention of another Google Pixel successor. Yes, you might be thinking that how is it so. It is...

Delayed April Fools’ Day Prank by LineageOS – Nothing to Worry

LineageOS had announced about its April Fools' Day prank timely back on Sunday but failed to release the actual update on time. This caused...

OnePlus 6 will have a support for hiding notch in post-launch software update

Currently, the notch on top of the screen is becoming a new trend in smartphones. After a handful of smartphones, OnePlus 6 is coming...
Windows 10

How to Build Redstone 4 RTM (17133.1) installation media using Media Creation Tool

As we know that RTM (Released to Manufacturer) builds are the one's made avilable for public.Today we are gonna learn how to make installation...

TCL Resurrects the Palm Inc. Brand with a New Smartphone to hit the Market...

TCL, a Chinese based global electronic company announces the resurrection of Palm Inc. Accordingly, the company is likely to launch a new Palm-branded smartphone...

Follow us to stay updated

144FansLike
7FollowersFollow
48FollowersFollow