Phonegap构建应用程序-不会自动显示inappbrowser窗口 [英] Phonegap build app - inappbrowser window is not shown automatically

查看:99
本文介绍了Phonegap构建应用程序-不会自动显示inappbrowser窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要创建一个简单的iOS应用程序,该应用程序可以包装一些现有网站(将在内部使用,当然不用于Apple Store).

We need to create a simple iOS App that is wrapper for some existing website (will be used internally, not for Apple Store of course).

我们正在使用Phonegap Build服务,并且已经构建了一些成功的应用程序.但是,使用此应用程序,我们会遇到一些问题.我们希望该应用在启动时在浏览器窗口中打开,这就是我们所需要的.我们在config.xml中包含了插件:

We're using Phonegap Build service and built a few successfull apps already. But with this app we have some issue. We want the App opens inappbrowser window when starts, and that's all we need. We include plugin in config.xml:

<plugin name="cordova-plugin-inappbrowser" source="npm" spec="~1.3.0" />

然后我们有一个js代码,应在设备浏览器的onDeviceReady状态下打开它:

then we have a js code that should open inappbrowser onDeviceReady state:

...
document.addEventListener('deviceready', function(){
 window.open("http://www.website.com/", '_blank','toolbar=no,location=no');
}, false); 
...

因此,无论您等待多长时间,启动App时都不会发生任何事情.但是,如果您最小化App并还原(主页"按钮,然后再次打开),则会看到该窗口全屏打开并且网站加载良好.那么为什么不自动打开呢?我们尝试将该功能分配给按钮单击,但没有成功-行为相同.我们尝试将其更改为cordova.InAppBrowser.open并将选项更改为工具栏=是等.没有成功.当最小化和还原时-显示窗口.在运行良好的Android上-加载应用后会自动打开窗口,您可以看到网站.有任何建议或帮助吗?

So when App is started nothing happens, no matter how long you wait. But if you minimize App and restore (Home button and then open again), you see that window opened fullscreen and site loaded well. So why it is not opened automatically? We trye to assign that function to button click, no success - same behaviour. We tried to change that to cordova.InAppBrowser.open instead and change options to toolbar=yes etc. No success. When you minimize and restore - window shown. On Android that works well - window is opened automatically on App load and you can see website. Any suggestions or help?

推荐答案

您必须在index.html

这篇关于Phonegap构建应用程序-不会自动显示inappbrowser窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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