在ios 9.3.1上的phonegap应用程序中使用iframe

Geo*_*nea 2 iframe ios cordova

我正在尝试在iOS 9.3.1上的phonegap应用中显示iframe.由于某种原因(因此这个问题),iframe显示在Android上但不在ios上.

设置:1.在Mac上,我安装了PhoneGap桌面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>
    
    Run Code Online (Sandbox Code Playgroud)
  2. 然后在安装了PhoneGap应用程序(https://itunes.apple.com/us/app/phonegap-developer/id843536693?mt=8)的iPad上进行测试:在Android上它可以工作,而在ios上它没有显示(i可以看到边框,但不是内容)

  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>
    
    Run Code Online (Sandbox Code Playgroud)

并添加到index.html中

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

Dhr*_*ruv 6

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

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

检查图像下方:

在此输入图像描述

第二件事你需要将外部主机添加为具有*值的项0的字符串.检查以下图片:

在此输入图像描述