A module filter.
Local storage cache
Stores inlined CSS and images in the browser's local storage for repeat visits.
Filter
local_storage_cache,inline_css,inline_images
·
Filter docs
·
Read the full guide
Both frames render identically — that's the goal. The win is in the bytes and requests
below, not the look. They're served live by the mod_pagespeed module on
demo-httpd-1.1.modpagespeed.com; the optimized frame
applies only this filter. Right after a cache purge it may briefly match the original while
the worker rewrites it — reload to see the result.
Measured impact
Measured on the Local storage cache demo page, original against optimized: 3 HTTP requests become 2; the total weight (HTML plus the files it loads) falls from 2.2 KB to 2.1 KB, 3% smaller; and the HTML document falls from 407 B to 374 B, 8% smaller.
HTTP requests
- original
- 3
- optimized
- 2
Total bytes
- original
- 2,206 B
- optimized
- 2,137 B
−69 B −3% in size
HTML size
- original
- 407 B
- optimized
- 374 B
−33 B −8% in size
What changed in the source
The page's HTML, before and after this filter. Red lines are removed, green lines are added.
<html>
<head>
<title>Local Storage Cache Test</title>
- <link rel='stylesheet' href="styles/yellow.css">
+ <style>.yellow {background-color: yellow;}
+ </style>
</head>
<body>
<div id="div" class="yellow">I should be on a yellow background ...</div>
Run this on your own site
This is one of 49 filters the mod_pagespeed module applies in place — self-hosted on Apache, nginx, and IIS. Install and run it: it optimizes right away and adds the optimized response headers shown above. Open source under the Apache License 2.0 — free in development and in production.