Stop Safari from switching your Twitter timeline

June 20 2022 by Jeff Johnson

Suppose you don't use Twitter for a week on one of your Apple devices. This can easily happen to me, because I own half a dozen Apple devices. Or suppose you decide to take a long break from "doomscrolling". Or maybe you just go on a vacation for a week. When you return home from your Twitter vacation, you may find that Twitter has also returned Home. In other words, your timeline has switched from the reverse chronological "Latest Tweets" to the algorithmic "Home". You'd probably blame Twitter for switching your timeline, as Twitter has been known to silently switch timelines, but I'll explain why the blame may actually lie with Safari.

If you look in the Storage tab of the Safari web inspector, you can see that Twitter stores some of its settings, such as home timeline behavior, in an IndexedDB.


If you change your timeline with the "sparkly" icon at the top of, the change will be reflected in that database. Your Twitter display settings such as font size and color scheme are also stored in the database.

This is where Safari's so-called Intelligent Tracking Prevention (ITP) comes in. There are many aspects to ITP, but here's the one relevant to our discussion:

7-Day Cap on All Script-Writeable Storage

Trackers executing script in the first-party context often make use of first-party storage to save and recall cross-site tracking information. Therefore, ITP caps the expiry of all cookies created in JavaScript to 7 days and deletes all other script-writeable storage after 7 days of no user interaction with the website. The latter storage forms are:

To put it simply, if you haven't visited Twitter in the past 7 days, then Safari will automatically delete your Twitter settings, including your font size, color scheme, and timeline behavior!

If you still don't believe that Safari could be so… "intelligent", you can trigger ITP yourself now without having to wait 7 days. Safari keeps track of the sites you've visited in a SQLite database file named observations.db under your Library folder. If you want to read this file, run the following commands in Terminal. (To be safe, quit Safari first.)

% sqlite3 ~/Library/Containers/
sqlite> .dump

To trigger ITP deletion of Twitter's IndexedDB, run the following commands.

sqlite> UPDATE ObservedDomains SET mostRecentUserInteractionTime=0.0 WHERE registrableDomain="";
sqlite> .exit

Boom! Err, boo!

Now you may ask, is there any way to stop Safari from deleting this data after 7 days? The good news is, yes! On macOS, enable "Show Develop menu in menu bar" at the bottom of the Advanced pane in Safari Preferences, then open the Develop menu, the Experimental Features submenu, and select "Disable Removal of Non-Cookie Data After 7 Days of No User Interaction (ITP)". On iOS, the same Experimental Features submenu is in the Advanced menu at the bottom of the Safari section in Settings.

By the way, one of the many great features of my Safari extension Tweaks for Twitter is automatically detecting that your timeline has been switched from Latest Tweets to Home. You just need to enable "Warn about Home timeline" in Tweaks preferences.

Jeff Johnson (My apps, PayPal.Me)