Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'View Safari cache files while offline' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
View Safari cache files while offline
Authored by: dknecht on Oct 28, '03 12:02:54PM

There is an example application in the Developer --> Example --> WebKit called DiskCacheInspector. You will need to have Xcode or Project Builder installed to compile the application. Once compiled it will startup and load all the cache files into a list that will allow you to view the content as raw html. I then just copy the html to a file and view it in Safari or paste it into an active SubEthaEdit (Hydra) document and use the built in html client. I am sure a saavy programmer can easily improve on this code and build and all in one app.

I have compiled a copy for those of you that don't have Xcode or Devloper tools. I didn't write this program and it is copyrighted to Apple Computer

[ Reply to This | # ]
View Safari cache files while offline
Authored by: jlongs2 on Dec 24, '04 04:07:53AM

In consideration of your agreement to abide by the following terms, and subject to these
terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in
this original Apple software (the "Apple Software"), to use, reproduce, modify and
redistribute the Apple Software, with or without modifications, in source and/or binary
forms; provided that if you redistribute the Apple Software in its entirety and without
modifications, you must retain this notice and the following text and disclaimers in all
such redistributions of the Apple Software. Neither the name, trademarks, service marks
or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
the Apple Software without specific prior written permission from Apple. Except as expressly
stated in this notice, no other rights or licenses, express or implied, are granted by Apple
herein, including but not limited to any patent rights that may be infringed by your
derivative works or by other works in which the Apple Software may be incorporated.

So this means that allowed to modify the source and redistribute the modifications, in source or binary, as long as... I don't give credit to Apple? Apple has a strange license...

[ Reply to This | # ]
View Safari cache files while offline
Authored by: oliverlangan on Sep 03, '09 03:01:19PM

Since this was posted, it seems that the cache file format has changed. It is now a SQLite database. The file can be found in the current user's folder:
You can browse the file with the sqlite3 command line tool, but it will be much easier to extract data if you use a GUI tool such as MesaSQLite.

[ Reply to This | # ]
View Safari cache files while offline
Authored by: tehthehteh on Nov 28, '11 04:31:34PM
Thanks for the tip! MesaSQLite looks great.

I put together this quick hacked shell script below, which gives you an overview of all images in the cache. It extracts the images from the cache, puts together a temporary HTML file on the desktop, opens the page in Safari and deletes it once loaded.
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\"" > ~/Desktop/cache.html
echo "    \"\">" >> ~/Desktop/cache.html
echo "<html lang=\"en\">" >> ~/Desktop/cache.html
echo "  <head>" >> ~/Desktop/cache.html
echo "    <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">" >> ~/Desktop/cache.html
echo "    <title>Cached Images</title>" >> ~/Desktop/cache.html
echo "  </head>" >> ~/Desktop/cache.html
echo "  <body>" >> ~/Desktop/cache.html
sqlite3 ~/Library/Caches/ "SELECT request_key, time_stamp FROM cfurl_cache_response WHERE request_key LIKE '%.jpg' OR request_key LIKE '%.jpeg' OR request_key LIKE '%.gif' OR request_key LIKE '%.png' ORDER BY time_stamp DESC;" | perl -ne 'chomp; ($url, $time) = split(/\|/); print "<a href=\"$url\"><img src=\"$url\" alt=\"Downloaded at $time\"></a> <a href=\"$url\">$url</a> $time<br>\n";' >> ~/Desktop/cache.html
echo "  </body>" >> ~/Desktop/cache.html
echo "</html>" >> ~/Desktop/cache.html
open -a Safari ~/Desktop/cache.html
sleep 1
rm ~/Desktop/cache.html
Open up Terminal, type "nano cache", paste in this script, save using 'Ctrl-X' and then 'Y'. Run "chmod +x cache" to make it executable. Now, anytime you want to bring up all cached images, you can open up Terminal, type 'cache' and woo! Images! It also keeps the URLs, in case you want to search for a file name. A word of warning though: there might be a lot of images in there.

[ Reply to This | # ]