Search code examples
iosiphoneurlqr-code

How to create a link for QR code to avoid iOS from opening an app and instead open the browser


We have a mobile app foo.com When someone with the mobile app on iOS tries to open a QR code with foo.com, i.e.,

https://webApp.foo.com/somepath?authToken

The mobile app opens and the user gets an error.

Android devices work fine even with the mobile app installed.

Is there a URL that would open the link in the browser without having to update the app or have users uninstall the mobile app?

Google Bard indicated that a schema of safari: would open the browser, but then how do you specify https?


Solution

  • You need to exclude the relevant path in your apple-app-site-association file hosted on your server.

    The full documentation is available here

    You will want something like

    {
      "applinks": {
          "details": [
               {
                 "appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
                 "components": [
                   {
                      "/": "/*",
                      "comment": "Matches any URL."
                   },
                   {
                      "/": "/somepath",
                      "exclude": true,
                      "comment": "Matches any URL with a path that starts with /somepath/ and instructs the system not to open it as a universal link."
                   },
                 ]
               }
           ]
       }