I'm using the InAppBrowser plugin for both Android and iOS apps. I have multiple URLs that I want to open outside the app in the device's external browser. This works as expected on both platforms in terms of opening the links.
However, there's a behavioral difference between iOS and Android when handling the app's state:
On iOS: When a link is opened in the external browser and the user minimizes the browser to return to the app, the app resumes as expected on the same screen without reloading. This is the desired behavior.
On Android: When a link is opened using the OpenInExternalBrowser function and the user returns to the app (after minimizing the browser), the app fully reloads. This only happens in this specific scenario. If I manually minimize the app and open the browser separately, the app resumes correctly when reopened — no reload occurs.
It seems that invoking the external browser via OpenInExternalBrowser on Android causes the app to be destroyed or backgrounded in a way that triggers a full reload when resumed.
Has anyone experienced this? Any ideas or workarounds to prevent the app from reloading on Android after returning from the external browser?
Hi @Danny Prager
Can you please check this link click here. Some JS for it.
cordova.plugins.backgroundMode.enable();
window.open(url, '_system');
Thanks
Hi
Idk if the JavaScript workaround will work or not. What I have in mind is that the ios auto suspends background apps to save battery and memory (its default behavior), resuming them upon reopening. I think you can try the Settings > General > Background App Refresh to modify it
This behavior could be because of how Android handles activity backgrounding when an app launches, like opening a browser.
When opening external browser using InAppBrowser → OpenInExternalBrowser (Android), it launches a new activity, OS kills your app’s activity to free memory, this destroys the WebView resulting in full restart on resume.
So, instead of opening in Chrome (external browser), use OpenInAppBrowser. InAppBrowser keeps everything in one activity, so Android does not background/kill the app.
But this is ideal if you don’t require the system Chrome UI.
Hope this helps.