Caches and cookies explained

What is the web cache, what are cookies, and why does clearing them solve so many browser issues?

How do web browsers work?

Websites are collections of code—that code is called HyperText Markup Language (HTML). The code is stored on servers (servers are just big fancy computer storage units—think of the hard drive on your computer multiplied by millions and millions). The Internet is what we call the network that links those servers together. When we enter the URL for a website in our browser’s address bar (or click on a link in a webpage), we end up connected to that webpage’s server, wherever it may be in the world. Our browser downloads the code for that page and translates that code into something pretty for us to look at.

Can we see the code?

You bet! In Firefox, pick a page, any page, say, my college’s home page. Click on the 3-dash menu icon in the top right corner of your browser, then click on Web Developer.

And then click on Page Source.

A page will open in a new tab, and you’ll see the code in all of its glorious detail. Anything in between these <brackets> is code. Anything outside of those brackets is text you can read on the webpage. (Similar tools exist for other browsers.)

What’s the cache?

When we visit a website, such as my college’s home page, our web browser downloads the code and keeps a copy of it. When it does that, our browser also notes the date the last time the page was edited. When we go back to that same page later, our browser will compare the page-edit date of our cached page with the page-edit date of the current page. If the two are the same, our browser will show us the version it has stored in its cache rather than take the time and bandwidth to download the one from the website. If it’s the same thing, why retrieve it again?

How things go wrong

Sometimes our browser will use a page it has cached rather than downloading a new one even when downloading a new one is warranted. If a webpage is acting funny (my apologies for using such high-level jargon)—particularly a webpage that requires a login—the first thing to investigate is if the cause may be the browser cache.

Ways to test for and solve cache issues

Option 1. Clear the cache for the entire browser. When we clear our browser’s cache, our browser doesn’t have any stored code it can use so it has to download the code fresh from the server. In this nuclear option, we can clear our browser’s entire cache, as in the cache for every webpage we’ve visited since the last time we cleared the cache. Here are instructions on how to do this for Firefox, Chrome, Edge, and Safari.

Option 2. Clear the cache for just the problematic webpage. This is a more surgical approach. While we can clear a single webpage’s cache through the browser’s settings menu, the means to do it are buried pretty deep in the settings. Instead, I recommend the keyboard shortcut (yes, write this on a sticky note; I have). Windows: CTRL+F5; Mac: Command+Shift+R, unless you’re using Safari, then Opt+Command+R. Clearing the cache for a single page is my go-to solution.

What are cookies?

Yummy treats. Duh.

Oh, you mean web browser cookies. Browser cookies are (not-at-all-tasty) files created by our browser that contain, say, some types of information we’ve entered for a particular website. For instance, to stay logged into a website, our browser will create a cookie with our login information. When our browser visits that webpage again, it will send the cookie file with that login information to the webpage’s server. Here’s another example. We visit an online retailer as a guest. We put some stuff in an online shopping cart. We close the page without buying anything. The contents of the cart may be stored in our browser’s cookie file for that website. When we go back to the page, our browser sends the cookie file to the webpage’s server, and our shopping cart will be filled automatically with our potential purchases. (Side note: If we’re logged into the online retailer, our online retailer will save the contents of our shopping cart on their own servers; they don’t need our cookies. That’s why when we visit—and log into—that retailer on a different device, e.g., our phone, we can see the contents of our shopping cart.)

Ways to test for both cache and cookie issues

Option 1. Open a private browsing tab. Firefox, Chrome, Edge, and Safari all have private/incognito browsing modes. When we launch a private/incognito browsing session (instructions here), a new tab will open and no code from any website we visit will be saved by our browser. Since our browser won’t keep a cache or a cookie file in private/incognito mode, for any page we visit, our browser will download fresh code and not upload any cookies.

Option 2. Try the page in a different browser. If you usually use, say, Chrome, open the website in, say, Firefox. The web browser we use less often is unlikely to have a cached copy of the webpage or have any cookies associated with the webpage, so the browser will retrieve a clean copy unsullied by cookies.

How to solve both cache and cookie issues

Dump everything. In web browser parlance, clear your browsing data. This will wipe clean your entire browser cache and delete all of your cookies. Here are instructions on how to do that for the most popular web browsers.

What if the webpage still isn’t working right?

The problem is almost certainly then with the webpage and not on your end. Contact whoever owns the website you’re wrestling with.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply