You are here

chrome

Caching trick when doing web development with Chrome

So the Chromium browser really loves to cache, its one of the reasons why its so fast. In fact, not even the usual holding of the SHIFT key and pressing refresh will bypass its caching, at least not using the latest version (7.0.517.41) under Ubuntu.

One workaround is to go into your preferences, click the "Under the hood" tab, click the "Clear browsing data", select "Empty the cache" checkbox, then click the "Clear browsing data" button. Wow, thats a lot of steps and when you're developing, this is a real pain in the ass.

There is another solution though. You can pass startup options to Chrome and set the cache to zero, that way the cache is never used. This is perfect for development because really, how often have you been screwed and sent on wild goose chases because of browser cache meanwhile you were trying to figure out why your changes didn't fix the problem?

So create another shortcut to Chrome and call this one Dev Chrome, or something uniquely identifiable. Edit the properties, specifically the startup options (called Command in Ubuntu) and add a parameter at the end that says:

--disk-cache-size=0

So the entire line should look something like:

/usr/bin/chromium-browser %U --disk-cache-size=0

Now when you do web development, launch and use your dev version of Chrome instead of your regular version. Voila!