“Save AnyThing” offline with a Google Gears bookmarklet

October 19th, 2007. Tagged: bookmarklets, Google Gears, JavaScript

Here's a little bookmarklet I came up with, I called "SAT", stands for "Save AnyThing (for offline reading)". It uses Google Gears and works like this:

  • you're about to go offline (maybe boarding a plane) and want to catch up on some reading
  • you visit any page
  • you click the SAT bookmaklet
  • it saves all the pages that are linked from the current page (only those on the same domain, you know, security and stuff)
  • you disconnect from the Net and read offline

Pretty cool, eh?

Initially I wanted to experiment with Google Gears and write a phpBB extension to save the latest forum topics for offline reading. But after thinking about it a bit I thought it can be done in an even more generic way and save anything for offline reading. All you need is a page that has a bunch of links, any page - a forum, a blog, the array section of the PHP manual... anything. After you run the bookmaklet, you'll have an offline copy of all the linked pages. Gotta love those bookmarklets, nothing to install, just a click in the favourites.



» Click here for a recorded demo

(demo is kinda clumsy, my first attempt in screen recording, I used Adobe Captivate, pretty bad I couldn't upload the result to youtube)

For a live demo, you can also test the bookmarklet by simply clicking the download links below.


Drag those two links to your favorites/bookmarklets. The first one is to store offline pages, the second is to remove the stored versions.

Source code

If you want to take a peek at the source code, the human-friendly versions are here:

Note on pages that will not be stored offline

Not all pages will be stored offline. I'm aware of these reasons why (there might be others)

  • same-origin security policy
  • Gears won't follow redirects

Comments, bugs

Thanks for reading, any comments are appreciated. My guess is the bug count will be pretty low, due to the fact that when the sh..., er, the bug hits the fan, you'll be offline and cannot report it 🙂

Now that I'm all set with stuff for offline reading for my short LAX-SJC flight tomorrow, I cannot help but wonder - should I still take with me a plain old reliable hardcopy of a piece of pulp fiction? You know... software breaks 🙂

Tell your friends about this post on Facebook and Twitter

Sorry, comments disabled and hidden due to excessive spam.

Meanwhile, hit me up on twitter @stoyanstefanov