Book Image

PhantomJS Cookbook

By : Rob Friesel
Book Image

PhantomJS Cookbook

By: Rob Friesel

Overview of this book

Table of Contents (15 chapters)
PhantomJS Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Generating an appcache manifest


This recipe expands on our usage of confess.js and shows how to use it to generate an application cache (appcache) manifest for our web applications.

Getting ready

To run this recipe, we will need a target URL. We will use confess.js to analyze the site and produce an appcache manifest.

Note

Details about how to obtain confess.js are included in the Listing CSS properties recipe earlier in this chapter.

Lastly, the script in this recipe runs against the demo site that is included with the book's sample code repository. To run that demo site, we must have Node.js installed. In a separate terminal, change to the phantomjs-sandbox directory (in the sample code's directory), and start the app with the following command:

node app.js

How to do it…

With the Node.js demo app running, make sure we are in the root directory for the book's sample code, and enter the following on the command line:

phantomjs lib/confess/confess.js http://localhost:3000/appcache-demo appcache...