//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 }); }); }) ); })


I completed BE computer since engineering and I am Freelancer, Blogger, and website developer. I love to know more about the latest tech and writing about it. In free time I prefer listening to music and playing computer games.

Reliance Jio planning to launch laptops with cellular connectivity with Qualcomm

To expand its empire, the Mukesh Ambani-led 4G only Reliance Jio planning to introduce always-connected laptops in the Indian market. The company has held talks with American chipmaker...

Rumor: Samsung Galaxy Note 9 come with 6.4-inch display and 4000 mAh battery

Last month, South Korean smartphone manufacturer launched its couple of this year flagship smartphones, called Galaxy S9 and Galaxy S9+. Now the company closer...
Samsung Galaxy J7 Duo 2

Samsung Galaxy J7 Duo 2018 launched with Dual rear cameras

Samsung has launched its new member of the Galaxy J series, called Galaxy J7 Duo 2018. The Galaxy J7 is the best selling smartphone...
10 Best Cases, Covers and Accessories for Huawei p20 Pro

10 Best Cases, Covers and Accessories for Huawei p20 Pro

So you're the proud owner of the Huawei P20 and now are worried no end to protecting it. Well, let your worries go to...
Galaxy A6

Samsung Galaxy A6 receives Wi-Fi certification by WFA

It looks like the Samsung is planning to transition its A-series from odd to even numbers for this year,  Samsung Galaxy A6. Recently, two models...
Vivo V9

Vivo V9 is launched in India with 24MP selfie camera at 19:9 display

Yesterday, Vivo has launched its mid-range smartphone in Thailand and Phillippines, called Vivo V9. And today, the company officially unveiled the Vivo V9 smartphone...
Samsung Galaxy J series

Samsung Galaxy J3 (2018) Variants Certified By WFA

It looks like the South Korean company, Samsung is working on its Galaxy J3 2018 mid-range smartphone to launch in US market via several...
Asus ZenFone 5Q

Asus ZenFone 5Q available for pre-order at NT$9,900 (~$339) price

Last month at Mobile World Congress (MWC 2018 event in Barcelona, Asus has unveiled its ZenFone 5Q smartphone along with ZneFone 5 and ZenFone...
YouTube for iOS Gets ‘Dark Theme’, Android to Add It Soon

YouTube for iOS Gets ‘Dark Theme’, Android to Add It Soon

The previous spring, YouTube revealed a gigantic refresh to its work area site that incorporated an update, speedier hidden system, and the expansion of...
Motorola Moto G6 series and Moto E5 series Certified In Asia

Motorola Moto G6 series and Moto E5 series Certified In Asia

The Lenovo owned company, Motorola has several new smartphones in the pipeline, but we have yet to learn what exactly the US company is...

Follow us to stay updated