HTML and CSS Reference
In-Depth Information
The FALLBACK Section of the Cache Manifest
The
FALLBACK
section of the cache manifest file specifies alternate files in case a resource can't be cached or
can't be accessed over a network. You can think of the
FALLBACK
section as an error-handling technique. If
the original resource is unavailable, you substitute some other resource. You can use the
FALLBACK
section
to provide substitute content or display an error message. For example, the Clock application uses the
FALLBACK
section to display a generic error message (see Listing 8-4).
Listing 8-4.
FALLBACK
Section of the Cache Manifest File
CACHE MANIFEST
CACHE:
...
NETWORK:
...
FALLBACK:
/ ErrorPage.aspx
Listing 8-4 uses
ErrorPage.aspx
as a generic error page for all resources (
/
) that can't be cached. Notice
the use of the
/
character: it indicates that for any resource that can't be accessed,
ErrorPage.aspx
should
be displayed. The
/
and the error page are separated by whitespace.
Before you proceed to the next section, make sure you save the cache manifest file as
Clock.
cachemanifest
in the root folder of your web application.
Referring to the Cache Manifest in Web Forms and Views
Now that you've created the cache manifest for the Clock application, let's see how to refer it in web forms
and views. Look at Listing 8-5.
Listing 8-5.
Referring to a Cache Manifest in
Clock.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Clock.aspx.cs"
Inherits="BasicOflineApp.WebForm1" %>
<!DOCTYPE html>
<html xmlns=”
http://www.w3.org/1999/xhtml” ma
nifest=”Clock.cachemanifest”>
<head runat="server">
<link rel="stylesheet" type="text/css" href="StyleSheet.css" />
<script type="text/javascript" src="Scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
...
</script>
</head>
<body>
<script src="Scripts/Ads.js"></script>
<form id="form1" runat="server">
<div class="clock">
<div id="date"></div>