Can I navigate onto the web without leaving a Capacitor application?


We have a web app with ADFS/GoogleId login workflow implemented with redirects. Our app redirects to an ADFS server which logs in or validates the user, then links back into our app. Is this achievable in Ionic/Capacitor? This page suggests that navigating away from your app should automatically pop in a browser, and this is the behaviour we see.

Is there some way of registering certain domains as ‘part of’ a Capacitor app, so we can navigate without leaving the webview? This would mean that a return url of the form ‘http://localhost‘ (or ‘capacitor://localhost’ for ios) could work.

Alternatively, if the browser takes over for the adfs domain, how can I construct a link that points back into the Capacitor app?


You can allow navigation to certain urls by adding allowNavigation inside the server object on the capacitor.config.json file

"server": {
    // Capacitor to open URLs belonging to these hosts inside its WebView.
    "allowNavigation": [

Note that it’s not intended for use in production apps, shouldn’t be used for OAuth or any other external urls you don’t own.

Answered By – jcesarmobile

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published