在我的混合移动应用程序(针对android和ios开发)中,我使用以下代码window.open("sample.html","_blank","location=yes")
在inappbrowser中启动sample.html页面。用它打开一个inappbrowser窗口,并在url中加载带有'X'标记的url和带有ios底部的'完成'按钮的sample.html页面。如果我们点击android中的'X'标记或ios中的'完成'按钮,它会关闭inappbrowser。现在我希望在点击sample.html中的按钮时具有相同的行为。我已经使用window.close(),但它不工作。如何在点击inappbrowser中启动的页面上的按钮时关闭phonegap inappbrowser?
我正在为我的应用程序使用IBM Worklight框架。
我已经尝试过类似的选项,但它没有为我工作。我认为所有分配给inappbrowser引用变量的addelistlistners都会在该事件从index.html执行但不从sample.html执行时起作用。在我的情况下,当sample.html页面上单击按钮/链接时,必须执行loaderror事件/函数。请让我知道,如果我不正确理解。 – user3878988 2014-12-11 20:24:53
@ user3878988,请参阅示例项目的答案。 – 2014-12-11 20:34:45
请注意,该应用程序是使用最近发布的Worklight Foundation 6.3(现称为MobileFirst Platform Foundation)构建的。因此,如果您使用的是较旧版本的Worklight,只需将index.html,sample.html和main.js中的代码复制到您自己的项目中即可。 – 2014-12-11 21:09:32