在ios 9.3.1上的phonegap应用程序中使用iframe [英] iframe in a phonegap app on ios 9.3.1

查看:98
本文介绍了在ios 9.3.1上的phonegap应用程序中使用iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



设置:
1.在Mac上,我安装了PhoneGap桌面v0.3.1并在index.html中添加了iframe


 < body> 
< iframe src =http://www.w3schools.comstyle =border-style:solid; width:750px; height:500px;/>
< div class =app>
< h1> PhoneGap< / h1>
< div id =devicereadyclass =blink>
< p class =event listening>正在连接到设备< / p>
< p class =event received>设备就绪< / p>
< / div>
< / div>

< script type =text / javascriptsrc =cordova.js>< / script>
< script type =text / javascriptsrc =js / index.js>< / script>
< script type =text / javascript>
app.initialize();
< / script>
< / body>


  • 然后在带有PhoneGap应用的iPad上测试(



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




    I'm trying to show an iframe in a phonegap app on iOS 9.3.1. For some reason (hence this question) the iframe shows up on android but not on ios.

    Setup: 1. on a mac, i installed PhoneGap desktop v0.3.1 and created a new app

    1. in index.html i added the 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. then tested on an iPad with the PhoneGap app (https://itunes.apple.com/us/app/phonegap-developer/id843536693?mt=8) installed: on android it works while on ios it does not show up (i can see the border, but not the content)

    3. then changed the config.xml to be more permissive

      <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>
      

    and added in index.html

    1. tested again with the same result as 3.

    解决方案

    Open your Info.plist file from Resources->ProjectName-Info.plist.

    Add below details: App Transport Security Settings as Dictionary and add Allow Arbitrary Loads to true.

    Check underneath image:

    And second thing you need to add External Hosts as a string with item 0 having * value. Check below images:

    这篇关于在ios 9.3.1上的phonegap应用程序中使用iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆