When Safari Database Cookies Keep Coming Back

Have you ever wondered why Safari retains data from websites even if you instruct it to remove all website data? If yes, you are not alone with your question. If you have ever removed cookies manually from your preferred web browsers, you must have noticed that sometimes it may take a few “Remove All” clicks for the cookies to disappear from your Mac, and yet still some ‘stubborn’ database files remain. In this article we will show you how to erase those stubborn files that keep coming back.

Clearing Cookies With Mac Optimization Apps

Privacy-conscious Mac users regularly clean their web browsers of cookies using third party Mac optimization software such as CleanMyMac or OnyX. As you may already know, websites often store cookies and other data locally on your own machine that contains information you have at some point provided: name, email address, preferences, and the like. Cookies are helpful for identifying you on a return visit to those sites.

Mac optimization apps are very helpful for doing the cookie cleaning (alongside any browsing history) but they fail to wipe away all the data left behind on your computer, such as database files from websites stored on your Mac.

What Are Those Database Files

As Apple explains to developers looking to launch websites, there are three independent components of the HTML5 client-side storage in Safari: the offline application cache, key-value storage and JavaScript database storage. The last option reduces server load by replacing server-side programs with client-side scripts, and this enables them to even store large amounts of structured data locally using an SQL-compatible JavaScript database. This allows website developers to keep user-generated and user-consumed data on the user’s computer and transfer the processing load from the server to the user’s CPU. It also allows the developer to limit the data set accessible to SQL over the internet.

You can use some websites to create and edit documents that are saved on your computer – for example, a travel log about your latest vacation. When you save the document, the website uses space on your computer to store your document as a database.

How to Remove Database Files From Your Computer

Interestingly, neither Firefox nor Chrome lists the database files when you search for them in Preferences and “cookies”. Apple’s strategy, on the other hand, is to inform users about the existence of such databases. These can be checked for yourself to find out if any website has stored data on your Mac by launching Safari and selecting Preferences, then the Privacy tab. Here, you’ll find all the cookies that websites have stored on your computer. Either go through them one by one or click “Remove all” to delete them. What will remain are only the websites with the “Databases” information below them.

To erase these files, follow the steps below:

Launch Finder.

Press Command-Shift-G (or “Go to Folder” from the “Go” menu).

Type this command: ~/Library/Safari/Databases.

Finder will launch the Safari databases folder.

Select all the entries you see there, and move them to Trash.

Empty Trash.

Although you have now successfully removed the database files, keep in mind that this won’t stop them from coming back if you are visiting sites that use JavaScript databases. Since Mac optimization apps cannot remove them, we recommend checking back from time to time and repeating the above steps. This is how you can achieve a much cleaner Mac and protect your privacy at the same time.