HTML and CSS Reference
n n n
Developing Offline Web Applications
Web applications are often looked on as wired applications that are connected to the network at all times.
This “always on” nature of web applications is one of the reasons for their popularity and rapid growth. In
today's Internet age, when network connectivity isn't a big deal, this characteristic of web applications
doesn't pose a problem in most scenarios. However, sometimes you can't guarantee network connectivity.
What should users of your application do then? Wouldn't it be nice if they could use your web application
even in the absence of network connectivity? That is precisely what HTML5 offline web applications offer.
At first glance, you may find the concept of web applications functioning in a disconnected or stand-
alone fashion slightly odd; but once you understand the scenarios in which they can help, you'll appreciate
this feature of HTML5. This chapter explains the concept of offline web applications as applicable to
HTML5. Specifically, you learn about the following:
• What ofline web applications are, and when to use them
• The cache manifest ile structure
• Creating and using a cache manifest in Web Forms and MVC applications
• Going online using Ajax techniques in situations where an ofline application wants
to talk with the server
• Using the applicationCache object and related events
When to Use Ofline Applications
Offline applications are best suited in situations where there is little or no communication between client
and server after the application files are downloaded at the client side. As the name suggests, offline
applications are web applications that don't have live access to server-side resources such as databases
and server-side code. Not all applications are good to go as offline applications. Therefore it's important to
understand when to use offline applications and when to avoid them. While deciding whether your web
application is a good candidate for going offline, you should consider these two basic questions:
• Does your application depend on live data?
• What impact will network downtime have on your web application and its users?
Suppose you're building a module for a sports portal that displays live cricket scores. Obviously your
visitors will use this module to check the latest status of a cricket match. It doesn't make sense for such a
module to go offline, because it relies on the latest data. The same can be said about web sites that provide