I've been using the cordova-plugin-inappbrowser plugin for a long time now and when I updated the software to 10.2.1 on my apple test devices the plugin no longs works properly. When I try to open the inappbrowser link nothings happens unless I click the home button and return to the app. This happens for the simulators as well as on real devices like ipad, iphone 5s, iphone 6 and iphone 7. it works fine on android devices just not the latest iOS.
Here's a list of everything i tried:
tried changing the index.html meta tag to include gap:
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' gap: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; child-src 'self' 'unsafe-inline' *;">
I can't seem to find anything else to try as most posts I do find that have a similar issue haven't been answered.
Below is the relevant code to how the inappbrowser plugin was installed and is being used:
config.xml Structure
<widget>
<content src="index.html"/>
<access origin="*"/>
<allow-navigation href="*"/>
<preference/>
...
<feature name="StatusBar">
...
</feature>
<platform name="ios">
... icons and splash ...
</platform>
<plugin name="cordova-plugin-inappbrowser" spec="~1.7.1"/>
</widget>
Using plugin in Controller
$scope.showLink = function(url){
var options = {
location: 'yes'
}
$cordovaInAppBrowser.open(url, '_blank', options)
.then(function(event){
// success
console.log('inappbrowser', event);
})
.catch (function(event) {
// error
console.log('inappbrowser error', event);
});
};
$scope.openUrl = function(url) {
window.open(url, '_blank', 'location=no');
};
I'm using ionic v1.7.14 , cordova: 6.2.0 and xcode 8
As suggested by CodeGems, in the comments, adding gap://ready
to your Content-Security-Policy
should fix the issue.