In this recipe, we will demonstrate how to use the
onResourceRequested callback to block files from downloading. Although we can use this technique to block any resource type, we will specifically be blocking CSS here; this can be useful to generate snapshots of how our sites look when the CSS fails.
To run this recipe, we will need a script that loads a web page; that web page must use CSS so that we can block the style sheet resources.
The script in this recipe is available in the downloadable code repository as
chapter03. If we run the provided example script, we must change into the root directory for the book's sample code.
Lastly, the script in this recipe runs against the demo site ...