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

Surface

Surface Pro 4

Microsoft releases the first firmware update for the new Surface Pro devices

Microsoft has just pushed out the first firmware update for the newest Surface Pro devices. The new firmware appears as "Surface – Firmware –233.1763.257.0"...
Surface Pro 4

Surface Pro 4 gets a new firmware update, enables support for new type cover

Microsoft is rolling out a new update for Surface Pro 4 devices which bring support for the new type covers and Surface Pro Signature Type...

The most powerful variant of the Surface Pro to be available after two more...

Microsoft unveiled its new "Surface Pro" last month and truly, it is the best Pro yet . The device is starting to be shipped...
Surface Studio

Microsoft releases a new firmware update for Surface Studio

We reported earlier this week that Surface Pro 3 is getting a new firmware update and now Microsoft has released a new update for...
Surface Pro

Microsoft releases a new firmware update for Surface Pro 3

Microsoft has released a new firmware update for Surface Pro 3 devices that improve battery life during sleep. The update is for Surface Pro Embedded...
Surface Pro 4

Deal Alert: Get $600 off on Surface Pro 4 with Intel Core i5, 128GB...

There's a sweet deal running on eBay where you can get a Surface Pro 4 with Intel Core i5, 128GB SSD, 4 GB RAM and...

Follow us to stay updated

144FansLike
7FollowersFollow
48FollowersFollow