Articles index

How to make a home page bookmark to Twitter in Mobile Safari

February 3 2022 by Jeff Johnson
Support this blog: StopTheMadness, Tweaks for Twitter, StopTheScript, Link Unshortener, PayPal.Me

A customer of my Safari web extension Tweaks for Twitter asked me how to add a bookmark to their iOS home screen to open Twitter in Mobile Safari. The Add to Home Screen command in the Safari share menu is supposed to accomplish this, but with Twitter the resulting bookmark behaves strangely: it doesn't actually open in Safari! Consequently, the bookmark is practically useless if you want to use web extensions, which only work in Safari.

Safari share menu

When you create the bookmark in Safari, everything appears to be fine. By the way, the full URL here is https://mobile.twitter.com/?utm_source=homescreen&utm_medium=shortcut, which means that whenever you open the home screen bookmark, Twitter knows that you opened a home screen bookmark.

Add to Home Screen https://mobile.twitter.com

Afterward you can see an icon on your home screen that looks just like the Twitter app.

Twitter PWA

Nonetheless, when you open the bookmark, it doesn't open in Safari.

Join Twitter today.

The bookmarked web page turns out to be a Progressive Web App (PWA). When you load mobile.twitter.com in Safari, the page signals that it supports PWAs, and thus Safari creates a PWA when it adds a bookmark for Twitter to your home screen. PWAs run separately from Safari and lack some of the features of Safari, such as web extensions.

Is there a way to create a normal bookmark on your home screen to mobile.twitter.com in Safari? Yes! I've discovered a trick to this, but the trick involves another one of my Safari web extensions, StopTheScript, which stops all JavaScript on your selected websites.

This trick cannot be accomplished simply by disabling JavaScript in Safari Advanced Settings. You can try that yourself to see how it fails.

JavaScript is not available.

Twitter can detect that JavaScript is disabled in Settings, and in this case Twitter still signals that it supports PWAs. So if you add to home screen, the bookmark is still a PWA.

Now let's try StopTheScript instead.

StopTheScript would like to access mobile.twitter.com.

Tap "Allow for One Day" to enable StopTheScript to run on mobile.twitter.com, and then reload the page.

twitter.com with no text.

Notice that Twitter hasn't detected that JavaScript is disabled. That's because StopTheScript uses a different technique for disabling JavaScript than Safari itself. It's my own little trick. Now we can add to home screen again.

Add to Home Screen https://mobile.twitter.com/home

The name is blank, because Twitter is no longer advertising PWA support. Just enter "Twitter" manually for the name.

Twitter home page bookmark

This time the bookmark icon is a screenshot of the web page. However, the icon will actually transform into the Twitter app icon after you open the bookmark! You don't want to open it quite yet though, because JavaScript is still disabled on Twitter. First go back to Safari Extensions Settings.

Safari Extensions Preferences, Permissions for StopTheScript

StopTheScript is currently allowed to access mobile.twitter.com, so you just need to switch it from "Allow" to "Ask", and then JavaScript will be enabled again on Twitter.

mobile.twitter.com Ask

And that's it! Your home screen bookmark will open Twitter in Safari instead of in a PWA. I don't know why Apple makes this so difficult, but I'm happy to provide a solution.

Support this blog: StopTheMadness, Tweaks for Twitter, StopTheScript, Link Unshortener, PayPal.Me

Articles index