|Mobile development type||Hybrid (Cordova app)|
|Cordova framework version||Cordova 5.0.0 and later|
Hybrid application that is deployed on an iOS device does not show the content of an iframe.
- Create or open a Cordova application.
- Change the target Cordova version to 5.0.0 or later.
- Include an
<iframe src=""></iframe>tag to an HTML view.
- Deploy the app to an iOS device.
Cordova 5.0.0 (Cordova for iOS 4.0.1) incorporates the Cordova whitelisting system, which provides a configurable security policy. As Cordova 5.0.0 is marked experimental in AppBuilder, project templates do not include the required configuration to enable whitelisting.
To enable whitelisting in your iOS application and allow the URL of an iframe to be accessed by the app, complete the following steps:
- Open the iOS Config.xml file in your project, as described here.
In that file, add the following code before the closing
<feature name="IntentAndNavigationFilter"> <param name="ios-package" value="CDVIntentAndNavigationFilter"/> <param name="onload" value="true"/> </feature>
Whitelist the URLs of the iframes, by adding the necessary
<allow-navigation>elements. For example:
<allow-navigation href="http://example.com/" />
For testing purposes, you can whitelist all URLs at once.
<allow-navigation href="*" />
Whitelisting all URLs is not recommended for production apps. You should allow only the domains used in your application.