Posts

Showing posts from January, 2018

Advertisement.

TransHimalaya.in

Everest Helicopter Tour for a day

Book exciting packages at www.transhimalaya.in

ASP.Net HTML5 Client Side Caching using Service Worker Simplified

Image
Client Side Caching Concept:

1. In HTML Era : Cookie was used to save content locally

2. In HTML5 Era: manifest file used to contain data like

Offline files
style.css
jquery.js

Online Files
img1.jpg


This scheme was deprecated in 2016

3. Latest HTML5 Caching: Service Worker.js

Your website must run on SSL to use the caching feature.

How it works:

1. You have to write this script in your html5 or aspx page at bottom of body tag to register the serviseworker.js

 <script type="text/javascript">
    // ServiceWorker is a progressive technology. Ignore unsupported browsers
       if undefined'serviceWorker' in navigator) {
            console.logundefined'CLIENT: service worker registration in progress.');
            navigator.serviceWorker.registerundefined'serviceworker.js').thenundefinedfunction undefined) {
                console.logundefined'CLIENT: service worker registration complete.');
            }, function undefined) {
                c…

Google+ Followers