Capacitor Browser can't open itms-apps:// links (to the App store)

Continuing the discussion from Is there any way to open external app from inappbroswer?:

Hi,

I have a similar issue, not with Whatsapp links, but with a link to rate the app in the App Store (starting with itms-apps://). I can’t get the capacitor Browser API (Capacitor - build cross platform apps with the web) to handle them.

I use the following code to open the App rating page in the app store:

import { Plugins } from '@capacitor/core';
const { Browser } = Plugins;
await Browser.open({ url: 'itms-apps://itunes.apple.com/...' });

See the response from XCode below. This was no issue with Cordova, but emerged when using Capacitor.

So my question is, how do I open itms-apps links with Capacitor?
Thanks
Jan

XCode throws the following error when trying to open the link:

:zap: [error] - ERROR {“rejection”:{“errorMessage”:“Unable to display URL”},“promise”:{"__zone_symbol__state":0,"__zone_symbol__value":"…"},“zone”:{"_parent":{"_parent":null,"_name":"","_properties":{},"_zoneDelegate":{"_taskCounts":{“microTask”:0,“macroTask”:0,“eventTask”:0},“zone”:"…","_parentDelegate":null,"_forkZS":null,"_forkDlgt":null,"_forkCurrZone":null,"_interceptZS":null,"_interceptDlgt":null,"_interceptCurrZone":null,"_invokeZS":null,"_invokeDlgt":null,"_invokeCurrZone":null,"_handleErrorZS":null,"_handleErrorDlgt":null,"_handleErrorCurrZone":null,"_scheduleTaskZS":null,"_scheduleTaskDlgt":null,"_scheduleTaskCurrZone":null,"_invokeTaskZS":null,"_invokeTaskDlgt":null,"_invokeTaskCurrZone":null,"_cancelTaskZS":null,"_cancelTaskDlgt":null,"_cancelTaskCurrZone":null,"_hasTaskZS":null,"_hasTaskDlgt":null,"_hasTaskDlgtOwner":null,"_hasTaskCurrZone":null}},"_name":“angular”,"_properties":{“isAngularZone”:true,“maybeDelayChangeDetection”:false},"_zoneDelegate":{"_taskCounts":{“microTask”:0,“macroTask”:0,“eventTask”:276},“zone”:"…","_parentDelegate":"…","_forkZS":null,"_forkDlgt":null,"_forkCurrZone":null,"_interceptZS":null,"_interceptDlgt":null,"_interceptCurrZone":null,"_invokeZS":{“name”:“angular”,“properties”:"…"},"_invokeDlgt":"…","_invokeCurrZone":"…","_handleErrorZS":"…","_handleErrorDlgt":"…","_handleErrorCurrZone":"…","_scheduleTaskZS":{“name”:""},"_scheduleTaskDlgt":"…","_scheduleTaskCurrZone":"…","_invokeTaskZS":"…","_invokeTaskDlgt":"…","_invokeTaskCurrZone":"…","_cancelTaskZS":"…","_cancelTaskDlgt":"…","_cancelTaskCurrZone":"…","_hasTaskZS":"…","_hasTaskDlgt":"…","_hasTaskDlgtOwner":"…","_hasTaskCurrZone":"…"}},“task”:{“type”:“microTask”,“state”:“notScheduled”,“source”:“Promise.then”,“zone”:“angular”,“runCount”:0}}

The answer you link is for InAppBrowser plugin, that is a Cordova plugin and it’s totally different from Capacitor’s Browser plugin. Browser plugin can only open http/https urls.

If you want to open other apps, you can use AppLauncher plugin

1 Like