我正在尝试在Cordova项目中显示一个网站,其中包含一个显示另一个网站的iFrame。即:
<html>
<head></head>
<body>
<iframe src="http://www.somesite.com" style="border: 0;" scrolling="yes"/>
</body>
</html>
当我在Safari中检查代码时,我得到了这个:
<html>
<head></head>
<body>
<iframe src="http://www.somesite.com" style="border: 0;" scrolling="yes">
#document
<html>
<head></head>
<body></body>
</html>
</iframe>
</body>
</html>
正如您所看到的,iFrame的内容未呈现。如果我在浏览器中打开网站,那么一切正常。如果我在没有cordova的iOS项目中打开它,我只使用一个简单的UIWebView就可以了。
我还发现当Codrova打电话时:
- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
当iFrame请求进入时,它返回NO。
有谁知道这可能是什么原因?
这是我的Cordova config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget android-version="@string/version" android-versionCode="1" id="com.appswiz.hybridfactory" version="4.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<plugin name="cordova-plugin-whitelist" version="1" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="SplashScreen" value="splash" />
<preference name="SplashScreenDelay" value="20000" />
<preference name="LoadingDialog" value="Loading, please wait..." />
<preference name="orientation" value="portrait" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<preference name="BackupWebStorage" value="local" />
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="BackupWebStorage" value="cloud" />
<preference name="DisallowOverscroll" value="true" />
<preference name="EnableViewportScale" value="false" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="GapBetweenPages" value="0" />
<preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" />
<preference name="PaginationMode" value="unpaginated" />
<preference name="UIWebViewBounce" value="false" />
<preference name="TopActivityIndicator" value="whiteLarge" />
<preference name="EnableLocation" value="false" />
<preference name="EnableViewportScale" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="OpenAllWhitelistURLsInWebView" value="false" />
<preference name="BackupWebStorage" value="none" />
<preference name="fullscreen" value="true" />
</platform>
<engine name="ios" spec="~4.1.1" />
<plugins>
<feature name="TwitterPlugin">
<param name="ios-package" value="TwitterPlugin" />
</feature>
</plugins>
<feature name="CalendarEventPlugin">
<param name="ios-package" value="CalendarEventPlugin" />
</feature>
<feature name="EmailComposer">
<param name="ios-package" value="EmailComposer" />
</feature>
<feature name="Updater">
<param name="ios-package" value="AWUpdater" />
</feature>
<feature name="YoutubeVideoPlayer">
<param name="ios-package" value="YoutubeVideoPlayer" />
</feature>
<feature name="File">
<param name="ios-package" value="CDVFile" />
<param name="onload" value="true" />
</feature>
<feature name="FileTransfer">
<param name="ios-package" value="CDVFileTransfer" />
</feature>
<feature name="Open">
<param name="ios-package" value="Open" />
</feature>
<feature name="Battery">
<param name="ios-package" value="CDVBattery" />
</feature>
<feature name="Camera">
<param name="ios-package" value="CDVCamera" />
</feature>
<feature name="Contacts">
<param name="ios-package" value="CDVContacts" />
</feature>
<feature name="Device">
<param name="ios-package" value="CDVDevice" />
</feature>
<feature name="Accelerometer">
<param name="ios-package" value="CDVAccelerometer" />
</feature>
<feature name="Compass">
<param name="ios-package" value="CDVCompass" />
</feature>
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>
<feature name="Geolocation">
<param name="ios-package" value="CDVLocation" />
</feature>
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
</feature>
<feature name="Media">
<param name="ios-package" value="CDVSound" />
</feature>
<feature name="Capture">
<param name="ios-package" value="CDVCapture" />
</feature>
<feature name="NetworkStatus">
<param name="ios-package" value="CDVConnection" />
</feature>
<feature name="SplashScreen">
<param name="ios-package" value="CDVSplashScreen" />
<param name="onload" value="true" />
</feature>
<feature name="Vibration">
<param name="ios-package" value="CDVVibration" />
</feature>
<feature name="AudioPlayerPlugin">
<param name="ios-package" value="PRXPlayerPlugin" />
<param name="onload" value="true" />
</feature>
<feature name="FacebookConnectPlugin">
<param name="ios-package" value="FacebookConnectPlugin" />
<param name="onload" value="true" />
</feature>
<plugin name="FacebookConnectPlugin" value="FacebookConnectPlugin" />
<access origin="https://m.facebook.com" />
<access origin="https://graph.facebook.com" />
<access origin="https://api.facebook.com" />
<access origin="https://*.fbcdn.net" />
<access origin="https://*.akamaihd.net" />
<feature name="PushNotification">
<param name="ios-package" value="PushPlugin" />
</feature>
<feature name="Calendar">
<param name="ios-package" value="Calendar" />
</feature>
<name>AppsWizAppShell</name>
<description>
The AppsWizShell.
</description>
<author email="admin@appswiz.com" href="http://www.appswiz.com">
AppsWiz
</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="http://*/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="CameraUsesGeolocation" value="false" />
<preference name="BackupWebStorage" value="none" />
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="GapBetweenPages" value="0" />
<preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" />
<preference name="PaginationMode" value="unpaginated" />
<preference name="UIWebViewBounce" value="false" />
<preference name="TopActivityIndicator" value="whiteLarge" />
<preference name="EnableLocation" value="false" />
<preference name="EnableViewportScale" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="OpenAllWhitelistURLsInWebView" value="false" />
<preference name="fullscreen" value="true" />
</widget>
感谢。