Html5 Offline Applications

19
HTML5 Offline Application s C# Corner – 13 Sep’14 Sunny Kumar

description

HTML5 Offline Applications

Transcript of Html5 Offline Applications

Page 1: Html5 Offline Applications

HTML5 Offline

ApplicationsC# Corner – 13 Sep’14 Sunny

Kumar

Page 2: Html5 Offline Applications

Agenda

• Application Cache• Anatomy of an Offline

Application• Cache Manifest• Application Cache Event Life

Cycle

Page 3: Html5 Offline Applications

Application Cache

The AppCache API facilitates caching of specified files locally based on manifest url- resulting in:

Offline Browsing Speed Reduced Server Load Resilience No Storage Limit * Event Driven API

Page 4: Html5 Offline Applications

Anatomy of HTML Offline Applications

Page 5: Html5 Offline Applications

Web Applications without offline mechanism

Page 6: Html5 Offline Applications

Offline Browser Support

Reference: http://caniuse.com/#feat=offline-apps

Page 7: Html5 Offline Applications

The Cache “manifest”

Is a simple text file which tells the browser what to Cache

Is a list of all the resources intended for offline accessibility

can be located anywhere on your web server

must be served with content type “text/cache-manifest”

the first line of manifest file is always ”CACHE MANIFEST”

Page 8: Html5 Offline Applications

The Cache “manifest”

Sample Manifest File

CACHE MANIFEST

/myStyles.css

/myScript.js

/centerImage.jpg

Suggested extension is “.appcache”

Page 9: Html5 Offline Applications

The Cache “manifest”

CACHE

FALLBACK

NETWORK

SETTINGS

4 Configuration Heroes

Page 10: Html5 Offline Applications

The Cache “manifest”

1. CACHECACHE MANIFEST # This is a comment

CACHE: /css/main.css/js/main.js/img/logo.png

explicitly cached resources

Page 11: Html5 Offline Applications

The Cache “manifest”

2. NETWORK

CACHE MANIFEST # This is a comment

CACHE: /css/main.css/js/main.js/img/logo.png

NETWORK:

*

usually just "*“. Allow to access files through network if not available in cache.

Page 12: Html5 Offline Applications

The Cache “manifest”

3. FALLBACK

CACHE MANIFEST # This is a comment

CACHE: /css/main.css/js/main.js/img/logo.png

NETWORK:

*FALLBACK:/ /offline.html

Resource to load, if requested resource is not available offline and network is not available.

Page 13: Html5 Offline Applications

The Cache “manifest”

4. SETTINGS

CACHE MANIFEST # This is a comment

CACHE: /css/main.css/js/main.js/img/logo.png

NETWORK:

*FALLBACK:/ /offline.html

SETTINGS:prefer-online | fast

Prefer-online:Prefer access resources from network when online

Fast:Access files from cache if available even when online.

Page 14: Html5 Offline Applications

The Cache “manifest”CACHE MANIFEST # This is a comment

CACHE: Default Section/css/main.css/js/main.js/img/logo.png

NETWORK:

*FALLBACK:/ /offline.html

SETTINGS:prefer-online | fast

Four Sections of Cache Manifest

Page 15: Html5 Offline Applications

AppCache Events

obsolete

checking

downloading

noupdate

cached

progress

updateready

error

Page 16: Html5 Offline Applications

Demo Time

http://www.spritecow.com/

Page 17: Html5 Offline Applications

• C# Corner MVP / Author / Speaker

• Microsoft Certified Professional

• Developer - .NET Stack

• twitter: @sunny_delhi

• email: [email protected]

• facebook: bit.ly/sunnykumar

My Credentials

Sunny Kumar

Page 18: Html5 Offline Applications

Do you have a

feedback?

http://goo.gl/bb83DL

Page 19: Html5 Offline Applications

Thank You!