'Cordova InAppBrowser - How to return to app on iOS device after clicking link
I am trying to allow the user of my Cordova Appery.io iOS app to click a link in the app to visit a website and be able to return to the mobile app. The issue on iOS devices is the user has no way to return to the app from the website without closing out the app and restarting it.
I am using the Cordova InAppBrowser 5.0.0 plugin per the example here https://docs.appery.io/docs/cordova-jquerymobile-inappbrowser. I actually built the sample app to experiment with on an iOS device (everything works fine on Android, but no way to go back on iOS with any of the sample app options). I even added the 'location=yes' option to the javascript window.open() call to no avail.
As a bit of history, using the deprecated 5.1 Appery library and the v3.2 of the Cordova InAppBrowser plugin worked on iOS providing a link back to the app after clicking a URL (this 5.1 Appery.io library will soon be removed from the system). But when using the latest 5.3 Appery library and the v5.0.0 InAppBrowser plugin, there's no way to return to the app on an iOS device after clicking a link.
Any suggestions or help would be greatly appreciated.
Solution 1:[1]
Please enable the Cordova plugin "WKWebviewEngineAllowFileAccessPlugin" it is required by inAppBrowser
Solution 2:[2]
Latest InAppBrowser version 5.0.0 available in Appery should be fine. You can use
var browser = cordova.InAppBrowser.open(targetURL, '_blank', 'location=yes');
On iOS, there will be a toolbar at the bottom of the page with Done button that will close InAppBrowser and return you to the app.
BTW, InAppBrowser tutorial was recently published by Appery team https://blog.appery.io/2022/05/how-events-scripts-work-with-inappbrowser-in-appery-io/
This is Ionic 5, but InAppBrowser options are essentilally the same.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Serhii Kulibaba |
Solution 2 | plotnik |