ios - ios 9.3.1 上 phonegap 应用程序中的 iframe

标签 ios cordova iframe

我正在尝试在 iOS 9.3.1 上的 phonegap 应用程序中显示 iframe。由于某种原因(因此出现这个问题),iframe 出现在 android 上,但没有出现在 ios 上。

设置: 1. 在 mac 上,我安装了 PhoneGap desktop v0.3.1 并创建了一个新应用

  1. 在 index.html 中我添加了 iframe

    <body>
        <iframe src="http://www.w3schools.com"  style="border-style:solid; width:750px; height:500px;"/>
        <div class="app">
            <h1>PhoneGap</h1>
            <div id="deviceready" class="blink">
                 <p class="event listening">Connecting to Device</p>
                 <p class="event received">Device is Ready</p>
            </div>
        </div>
    
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
    
  2. 然后在安装了 PhoneGap 应用程序 ( https://itunes.apple.com/us/app/phonegap-developer/id843536693?mt=8 ) 的 iPad 上进行测试:在 Android 上它可以工作,而在 iOS 上它不显示(我可以看到边框,但看不到内容)

  3. 然后将 config.xml 更改为更加宽松

    <access origin="*" />
    <allow-intent href="*" />
    <allow-navigation href="*" />
    
    <plugin name="cordova-plugin-whitelist" version="1"/>
    <allow-intent href="*" />
    <allow-navigation href="*" />
    
    <platform name="android">
      <allow-intent href="*" />
    </platform>
    <platform name="ios">
      <allow-intent href="*" />
    </platform>
    

并添加 在 index.html 中

  1. 再次测试,结果与 3 相同。

最佳答案

从 Resources->ProjectName-Info.plist 打开您的 Info.plist 文件。

添加以下详细信息: App Transport Security Settings as Dictionary 并将 Allow Arbitrary Loads 添加为 true。

检查下图:

enter image description here

第二件事,您需要将外部主机添加为字符串,其中项目 0 具有 * 值。检查以下图片:

enter image description here

关于ios - ios 9.3.1 上 phonegap 应用程序中的 iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36835993/

相关文章:

ios - 以编程方式替换 Assets 目录中的图像 iOS

iOS 13 - 我们可以使用 xib 作为启动 Storyboard的启动屏幕吗?

iphone - 如何折叠/折叠 UITableView 的部分?

cordova - Phonegap 合并目录 - Assets 未合并

angularjs - PhoneGap + Angular + IOS = ng-show 在屏幕上闪烁内容

iphone - tableview 删除部分中的最后一行

java - 安卓奇巧 : fileChooser + fileTransfer cordova plugin not working

javascript - 将第三方的 HTML 菜单集成到我的应用程序中

html - 在 Iframe 中打开的下拉选项

javascript - 更改 iframe 内容