How to set the default browser on iOS

Johannes Hagemann
Space Browser
Published in
4 min readApr 13, 2019

In this blog post I will show you a useful hack we recently discovered to set your default browser on iOS, how you can use it and other cool stuff that is possible through this hack.

Long story short: You have to overwrite the http and https url schemes in your iOS application. Then the user has to turn off Safari in his Content & Privacy Restrictions. That’s basically it. 😄

If you wanna know exactly how this is possible follow the example app tutorial:

What are URL schemes?

URL schemes are used to launch system apps and third-party apps trough URLs. For example to facetime someone you can type into your browser facetime://+123456789. Furthermore you can create your own customs url schemes, so that other applications can launch your app via these urls.

For your reference here is a list of url schemes for various apps:

How can you use it?

Create a new Xcode iOS Project, select Single View App, enter a name (like URL Schemes Sample) and continue. Then:

  1. Go to your projects settings, select your app’s target and click on the Info section at the top.
  2. Search for the URL Types section and add an entry.
  3. Add an identifier (easiest way is to use your bundle identifier), add the URL Schemes you want to overwrite (in our case http) and set the role to Viewer.
  4. Repeat step 2 and 3 for the URL Scheme https.
It should look like this.

5. Open your AppDelegate.swift and add this function:

Now it’s up to you, how you handle the incoming URL. :) For this example app I decided to just show an alert displaying the URL.

6. Your users have to do some configurations so that this hack is possible. They can follow these few instructions we implemented into our Space Browser:

You did it! From now on every link you click will open directly in your new app.

Other cool stuff that is possible

After discovering you can overwrite the https and http url schemes in iOS, I tried out a few other system app schemes.

For some applications it is possible to overwrite them, but for the important ones it isn’t possible, such as Facetime or Mail.

Here are others which worked for me:

Podcast:

It’s possible to overwrite the URL Schemes. If you want to do that, you have to overwrite the following URL Schemes:

  • pcast, itms-pcast, itms-pcasts, podcasts, itms-podcast and itms-podcasts

Just follow the steps 2 and 3 of the tutorial. Additionally, the user has to turn off the Podcast App in the Content & Privacy Restrictions settings.

This hack could be interesting for all podcast apps out there. Every time someone clicks on a podcast link, their app opens instead of the built-in Apple Podcast app. Here is a short demonstration:

iTunes Store

It’s also possible to overwrite the iTunes Store URL Schemes. These are:

  • itms and itmss

In this case, however, I don’t see a good use case where this hack can be used. It’s rather a security issue.

Conclusion

What was unusual: each app showed different behavior when you overwrote its URL scheme and disabled it in the Content & Privacy Restrictions.

I know that these hacks depend on the user. And they have to make changes to their settings. However, little social engineering tactics are needed to get many users to do that. Nevertheless, I hope Apple won’t close this “security issue”, but will review the apps to see if someone is overwriting the url schemes with a good intention (as we do with Space Browser) or using it for malicious purposes.

You can find a demo project here, where I just randomly tried to overwrite some URL schemes.

https://github.com/JohannesHa/OverwriteURLSchemes

ABOUT US

We are building Space Browser - The first mobile browser made for power users. Space let’s you can organize your tabs into spaces, which act like smart folders and we make it easy to recall your tabs with the help of our rethought history, where you can travel back in time to restore entire sessions or just that one tab you were searching for.

You can download the Space Browser beta for your iPad here:

https://testflight.apple.com/join/UZCCWbHA

We would love to hear your feedback! :)

Also don’t forget to check out our demo video:

--

--