HTML and CSS Reference
accomplish this is to call the window.location.reload() method. Alternatively, you can call the
applicationCache object's swapCache() method. swapCache() replaces the older cache with the newly
downloaded one and begins using the new cache without requiring any page refresh as in the case of
n Note The applicationCache object also exposes a status property that returns a numeric status code
depending on the state of the object (1 for Idle, 2 for Checking, and so on). However, in most cases, using
applicationCache object events offers much more flexibility and control than using the status property.
ASP.NET MVC Example: the Survey Application Revisited
In the preceding sections, you worked with the Web Forms-based Clock application. To create an offline
application using ASP.NET MVC, you follow the same steps. For the sake of completeness, let's convert the
Survey application you developed in Chapter 7 into an offline application. The Survey application may not
be the best candidate for offline use, but think of a slight variant of it.
Suppose a big software development company frequently recruits junior- and senior-level software
developers. The company receives hundreds of job applications from interested candidates, and it's
impossible to conduct personal one-to-one interviews with all the applicants. Hence the company wants
to develop an online examination engine that presents a series of single-choice, multiple-choice, and
descriptive questions to candidates. The candidates can take the online exam anywhere, at their
convenience. This online test becomes a basis for filtering the candidates. Only successful candidates are
then called for interview. In the case of an online examination engine, candidates may remain on a page
for a long time because they're thinking about the correct answers. Such an application can be nicely
developed as an offline application. By now you must have guessed that the Survey application, although
not exactly an online exam engine, resembles this scenario.
Let's carry out the steps required to convert the Survey application into an offline application. The
offline version of the Survey application is shown in Figure 8-6.