Cordova IOS的iApp浏览器phoneGap将不会从本地服务器加载页面

Cordova IOS的iApp浏览器phoneGap将不会从本地服务器加载页面,cordova,inappbrowser,Cordova,Inappbrowser,以下是我正在使用的代码: <html> <head> <script> function open_win() { window.open(encodeURI("<inserturlhere>")) } </script> </head> <body> <input type="button" value="Open Window" onclick="open_win()"> </body&g

以下是我正在使用的代码:

<html>
<head>
<script>
function open_win()
{
window.open(encodeURI("<inserturlhere>"))
}
</script>
</head>
<body>

<input type="button" value="Open Window" onclick="open_win()">
</body>
</html>

函数open_win()
{
window.open(encodeURI(“”)
}
它适用于谷歌、apache等其他网站


我已授予对config.xml文件中所有域的访问权限。

我认为您在窗口末尾缺少分号()。如果是错误编写的,请打开,然后尝试以下代码

<html>
  <head>
    <script>
      var ref=null;

      function iabLoadStart(event) {
         console.log(event.type + ' - ' + event.url);
      }

      function iabLoadStop(event) {
         console.log(event.type + ' - ' + event.url);
      }

      function iabClose(event) {
         console.log(event.type);
         ref.removeEventListener('loadstart', iabLoadStart);
         ref.removeEventListener('loadstop', iabLoadStop);
         ref.removeEventListener('exit', iabClose);
      }

      function open_win() {
         ref=window.open(encodeURI("<inserturlhere>"),'_blank', 'location=no');
         ref.addEventListener('loadstart', iabLoadStart);
         ref.addEventListener('loadstop', iabLoadStop);
         ref.addEventListener('exit', iabClose);
      }
    </script>
  </head>
  <body>
    <input type="button" value="Open Window" onclick="open_win()">
  </body>
</html> 

var ref=null;
函数启动(事件){
日志(event.type+'-'+event.url);
}
函数停止(事件){
日志(event.type+'-'+event.url);
}
功能关闭(事件){
console.log(事件类型);
参考removeEventListener('loadstart',IbaLoadStart);
参考removeEventListener('loadstop',IbaLoadStop);
参考removeEventListener(“退出”,关闭);
}
函数open_win(){
ref=window.open(encodeURI(“”),“空白”,“位置=no”);
参考addEventListener('loadstart',IbaLoadStart);
参考addEventListener('loadstop',IbaLoadStop);
参考addEventListener(“退出”,关闭);
}

您是指从文件系统提供服务的本地文件吗?Ie.file://而不是http://?在这种情况下,我认为这是当前Phonegap版本的一个bug

我一直将此用作解决方法(打开inappbrowser实例):

请参阅我添加的
(navigator.userAgent.indexOf('Android')!=-1?)file:///android_asset/www/“:”
作为url前面的前缀。现在,它检测你的应用程序何时在Android上,并在其前面添加本地URL

// Image zoom
$('#container').on('tap', '#content.cmscontent img', function() {
    var browser = window.open((navigator.userAgent.indexOf('Android') != -1 ? 'file:///android_asset/www/' : '') + encodeURI($(this).attr('src')), '_blank', 'location=no,toolbar=yes,enableViewportScale=yes,transitionstyle=crossdissolve');
});