Levvel Blog - How to Change Your Default Browser in iOS

How to Change Your Default Browser in iOS

In short, iOS will open links in whichever app has the http or https schemes registered as its URL type when Safari is disabled in the Restrictions settings in iOS. Try it now by disabling Safari, downloading UpTime Web Browser, and then opening a link in any app.

URL types in iOS allow developers to register their app as the supporting links with a given URL scheme. A URL scheme is the first part of any URL (or technically a URI) up to the colon. http, https, ftp, mailto and file are examples of well-known schemes. Application developers can also create a custom scheme for their app if they want a user to be able to open a link to their app from the web or another app. It also allows developers to store a little bit of information in the URL, such as data related to the action the user wants to take or a callback URL, such as X-callback-url.

For example, if a developer wants to allow a user to subscribe to a podcast in the developer’s podcast playback app, then the developer would register that their app supports a new unique scheme such as my-awesome-podcast-app. Then the developer would share a link such as

my-awesome-podcast-app://sample-host/desired-podcast=this-american-life-feed-url

iOS will send the full URL to the developer’s app, which can then pull out the desired podcast to subscribe to. This happens in the `application(_:open:options:)` method of their App Delegate subclass. To clear up any confusion with this example, normally podcast links are RSS Feeds or JSON Feeds. However, this example wraps a podcast feed in a new URL with a unique scheme for the app to get around the limitation that iOS only opens feed URLs in Apple’s Podcast app.

X-callback-url

X-callback-url is a community-created standard for including callbacks to the calling app in a URL. For example, say a developer wants to create an app for composing micro blog posts, but they don’t want to support all the different social networking APIs out there. They would rather just send the text to an app that the user wants to post through and then have the user return to their app when the the social network app is finished posting. To accomplish that task, a developer could create a URL with the custom scheme of the social networking app, the text data of the post, and the custom scheme of the developer’s app. The URL would look like this where:

target-fancy-new-social-network-app://x-callback-url/post?x-source=my-source-app&text=hello-world

Target-fancy-new-social-network-app is the scheme of the social networking app, and my-source-app is the scheme of the developer’s app. The x-callback-url as the host is part of the x-callback-url standard. X-callback-url is great because it allows developers to facilitate inter-app communication as long as the data payload is small enough—though one workaround for that is to include a URL to where the target app can download a larger amount of data hosted somewhere on the internet.

Registering Well-known URL Schemes

While it would be great if an iOS developer could register their third-party mail app as the default mail app to open mailto scheme links (or any other well-known URL schemes besides http and https) like on macOS, iOS currently does include this feature. However developers can claim support for the http or https schemes. You can see this in action by downloading the UpTime Web Browser app, disabling Safari by opening Settings.app, tapping General, tapping Restrictions, and finally setting the Safari switch to the off position. Then open any link. The first time you do this, iOS will display a pop-up asking if the user would like to open the UpTime Web Browser app. From that point forward all links will open in the UpTime Web Browser app. The app also allows you to set a default browser by tapping on the info button in the toolbar to get to settings and then change the default browser to Chrome or Firefox under the ‘Long press opens in:’ setting.

So now you might be thinking, “Why can’t I do this for mail or maps apps as well?”. Unfortunately this won’t work for mail, maps or any of the other well-known URL schemes because only Safari, not Mail or Maps, can be disabled in the restriction settings. While Apple’s Mail app can be deleted, when opening mailto scheme links, a system pop-up asks the user if they want to redownload Mail.app from the App Store. File a Radar to Apple if you would like to request that Apple allow third-party apps to register for other well-known schemes and to allow users to select their preferred default web browser, map, podcast, or other app.

Steve Moser

Steve Moser

Senior Consultant

Steve Moser is a Mobile Application Developer at Levvel focusing mainly on iOS. He is passionate about leveraging software to deliver great experiences.

Related Posts