Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Dreamweaver

Adobe Dreamweaver CS5.5 Studio Techniques: Making Your Site Available Offline

In this chapter, you'll learn how to make a site available offline by creating a file that not only tells the browser which files to cache, but also specifies substitute files for offline use.
This chapter is from the book
  • You can't always get what you want,
    But if you try sometimes,
    You might get what you need.
  • —The Rolling Stones

Loss of signal is probably one of the most frustrating aspects of surfing the web with a mobile device. You've just clicked a link and the page is beginning to load when your train enters a tunnel. Your connection disappears. Even when the train emerges from the tunnel, your mobile has to hunt for a signal and you often need to start all over again.

HTML5 can't improve mobile connectivity, but it does make it possible to continue interacting with websites, even when no network connection is available. The secret lies in caching the necessary files. Although browsers automatically cache recently downloaded files, what's different about HTML5 is that you can instruct the browser to download files in advance of their being needed. You can also specify alternative files to be displayed if the user is offline.

In this chapter, you'll learn how to make a site available offline by creating a file that not only tells the browser which files to cache, but also specifies substitute files for offline use. To speed up this process, the download files for this chapter contain a Dreamweaver extension that I created to generate a list of all files used in a site or folder.

How Offline Sites Work

To make a site available without a network connection—an offline web application, as the HTML5 specification calls it—you need to create a manifest. This is a list of files that the browser needs to download and store in an application cache. The first time someone visits your site, the browser checks the manifest and downloads the listed files ready for use offline. The next time the same user visits your site, the browser checks the manifest. If it detects a change, all the files are downloaded again, updating the application cache.

Figure 4.1 shows which browsers support offline applications as reported by Light green shows full support; darker green shows partial support; and pink indicates no support. Internet Explorer (IE) is the only mainstream browser with no support. Crucially, though, iOS Safari, Android, and Opera Mobile all support offline access, making it ideal for websites that you expect to be accessed on mobile devices.

Figure 4.1

Figure 4.1 Most modern browsers apart from IE support offline access.

Creating a Manifest

The manifest is a plain text file that must be saved with a .manifest filename extension. It's not important where you locate the manifest, but the most logical place is in the site root. However, if you want to make only part of a site available offline, the manifest should be located in the relevant folder and cover the files in all subfolders. The first line inside the manifest file should look like this:


There should be only a single space between CACHE and MANIFEST, both of which should be in uppercase.

Following this is a list of files grouped according to how you want them to be treated when the user is offline:

  • Explicit section. All files in this section are downloaded automatically, even if they're not required for the current page.
  • Online whitelist section. Files in this section are never cached. The browser always tries to access the online version.
  • Fallback section. This is where you specify substitute files that the browser should use when the user is offline.

The following basic rules apply to all sections:

  • Each file must be listed on a separate line, except in the fallback section where the original and substitute files are listed on the same line with a space between them.
  • Document-relative paths should be relative to the manifest.
  • Paths relative to the site root (in other words, those that begin with a leading slash) or fully qualified URLs are also acceptable.
  • The list should include not only web pages, but other assets, such as images, style sheets, and JavaScript files.
  • Blank lines are permitted.
  • Comments can be included, but they must be on a separate line beginning with a hash or pound sign (#) optionally preceded by spaces or tab characters.

Sections can be listed in any order and don't need to be a single block. For example, you might want to make some files available offline only for a limited period. So, it makes sense to list them separately from the core files that don't normally change.

You create sections by placing a section header on a separate line.

Specifying files that should be cached

The explicit section is the default, so files listed immediately after CACHE MANIFEST are automatically downloaded and cached. To switch back to the explicit section after the online whitelist or fallback section, place the following section header on a separate line:


Specifying files that must always be accessed online

Server-side scripts and other files that you don't want to be cached locally should be listed in the online whitelist section. You create this by adding the following header on a separate line:


Then list the path or URL of each file on a separate line in the same way as for files that you want to be downloaded.

If your site accesses resources on other domains or subdomains, you should add an asterisk (*) on a line of its own in the online whitelist section like this:


This indicates that access to resources on other domains is not blocked.

Specifying alternative files to use offline

To specify alternatives for files that can't be accessed offline, create a fallback section by placing the following section header on a separate line:


Each entry in the fallback section lists a file in the online site followed by the location of a substitute file to be used when offline. Both files are listed on the same line and separated by one or more spaces.

To represent any file, use a single forward slash (/) as the first part of the entry. For example:

/ offline.html

This substitutes offline.html for any file not listed elsewhere.

Keeping the cache up to date

More often than not, updates to a site involve changing the contents of a file without changing its name. This presents a problem for the application cache. The browser checks only the filenames in the manifest. If they're the same, it assumes the cache doesn't need updating.

To force the browser to update the cache, you need to change the contents of the manifest. The simplest way to do this is to add a comment with a version number like this:

# version 4

Increment the version number each time you make changes to the site, and upload the revised manifest after all the changes have been uploaded. You don't need to use a version number. Any unique value—such as a timestamp—in a comment will do.

Serving the Manifest

You attach a manifest to a web page with the HTML5 manifest attribute in the opening <html> tag like this:

<html manifest="mysite.manifest">

The value of the manifest attribute should be a document-relative or site-root-relative path to the manifest file.

You should do this in every page in a site that you want to make available offline.

It's important to serve the manifest with the correct MIME type: text/cache-manifest.

Because this is a new MIME type, it might not be supported by all servers.

Setting the correct MIME type on Apache

If your web server runs on Apache, you should be able to configure it using an .htaccess file in your site root. If you already have an .htaccess file, add the following line to it:

AddType text/cache-manifest .manifest

If you don't have an .htaccess file, you can create one in Dreamweaver:

  1. Choose File > New.
  2. In the New Document dialog box, select Other from the list on the left, and set Page Type to Text. Click Create.
  3. Type the following line of code into the new document, paying careful attention to spelling (Apache directives are case-sensitive):
    AddType text/cache-manifest .manifest
  4. Save the file in your site root with the name .htaccess. The name begins with a dot. Although it's a text file, make sure it's not saved with a .txt filename extension.

    On Windows, the file will be saved as normal.

    On a Mac, you'll see a warning that files with names that begin with a dot are reserved for the system and will be hidden (Figure 4.2). Click Use ".". The file will be listed as normal in the Dreamweaver Files panel. However, you won't be able to see it in the Finder or any other Mac program unless it supports hidden files.

    Figure 4.2

    Figure 4.2 On a Mac, Dreamweaver warns you that names beginning with a dot have special status.

  5. Upload the .htaccess file to your website.

Setting the MIME type on other web servers

If your website is on a server other than Apache, you need to ask the server administrator to enable the text/cache-manifest MIME type.

Creating a "Lazy" Manifest

The HTML5 specification includes among its examples the following extremely simple manifest:

/ /offline.html

Instead of downloading all pages immediately, the browser stores only the fallback page (offline.html) and pages that are visited while the user is online. When the user goes offline, cached pages are retrieved from the user's application cache. But if the user clicks a link to a page that hasn't previously been visited, offline.html is displayed instead.

This lazy way of caching can be very useful on a large site. However, you still need to update the manifest with a version number or other unique value each time a page is edited. Otherwise, the old version of the page remains in the application cache.

Only HTML pages can be linked to a manifest. So, other resources—such as style sheets and images—are not stored in the application cache unless they're listed in the explicit section of the manifest.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive:

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020