PhoneGap 3.0 InAppBrowser - 无法让用户关闭 [英] Phonegap 3.0 InAppBrowser - Provides no way for user to close

查看:372
本文介绍了PhoneGap 3.0 InAppBrowser - 无法让用户关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中工作的ApBrowser很好...但是,我升级了一些东西,现在它打开URL没有任何方法关闭它。你必须杀死应用程序。



我尝试了很多变体: window.open('http://cnn.com', '_blank','location = yes,toolbar = yes');



myconfig.xml具有:

 < feature name =InAppBrowser> 
< param name =ios-packagevalue =CDVInAppBrowser/>
< / feature>

我没有错误...页面打开...但没有办法关闭和返回到应用程序。我看到很多人提出解决方案的URL识别和使窗口关闭...但我需要childBrowser插件方法...用户可以在他/她完成查看页面时关闭窗口。



Phonegap 3.0 -
JqueryMobile 1.2 -
IOS 7.0.2 -
xCode 5.0 -


解决方案

您的语法看起来不错,但是试试这些代码片段:



纯JavaScript:



var ref = window.open('http:// cnn .com','_blank','location = yes,toolbar = yes');



HTML + JavaScript:



< a href =#onclick =var ref = window.open('http://cnn.com','_blank','location = yes,toolbar = yes');> CNN Link< / a>



此外,检查您是否正确安装了InAppBrowser插件(PhoneGap / Cordova 3.0+需要通过命令行单独安装)。您的config.xml文件看起来是正确的,但只是确保插件的其余部分已正确安装。



您可以使用以下命令列出所有已安装的插件您的项目...



使用Cordova: cordova插件



使用PhoneGap: phonegap本地插件列表



您也可以转到您的桌面, plugins文件夹,并检查在其中是否有一个名为org.apache.cordova.inappbrowser或org.apache.cordova.core.inappbrowser的文件夹。



要安装InAppBrowser插件(如有必要)...



使用Cordova: cordova插件add org.apache.cordova.inappbrowser



使用PhoneGap: phonegap local plugin add org.apache.cordova.inappbrowser p>

在您的描述中,您的网页似乎在应用的网页视图中打开,而不是InAppBrowser窗口。这是你通常使用'_ self'而不是'_ blank'时会得到的行为。希望这里的东西有助于解决这个问题。


I had inApBrowser working in my app just fine... however, I upgraded some things and now it opens the URL without any way of closing it. You have to kill the app.

I have tried many variations of this: window.open('http://cnn.com','_blank','location=yes,toolbar=yes');

myconfig.xml has:

<feature name="InAppBrowser">
    <param name="ios-package" value="CDVInAppBrowser" />
</feature>

I get no errors... the page opens... but there is no way to close and return to the app. I have seen a lot of folks putting solutions for URL recognition and making the window close... but I need the childBrowser plugin method... where the user can close the window when he/she is finished viewing the page.

Phonegap 3.0 - JqueryMobile 1.2 - IOS 7.0.2 - xCode 5.0 -

Any help would be greatly appreciated!

解决方案

Your syntax looks okay, but give these code snippets a try:

Pure JavaScript:

var ref = window.open('http://cnn.com', '_blank', 'location=yes,toolbar=yes');

HTML + JavaScript:

<a href="#" onclick="var ref = window.open('http://cnn.com', '_blank', 'location=yes,toolbar=yes');">CNN Link</a>

Also, check that you have correctly installed the InAppBrowser plugin (PhoneGap/Cordova 3.0+ need it to be installed separately via the command line). Your config.xml file looks correct, but just make sure that the rest of the plugin is installed properly.

You can use the following commands to list all the installed plugins in your project...

Using Cordova: cordova plugins

Using PhoneGap: phonegap local plugin list

You can also just go to your Desktop, navigate to the 'plugins' folder within your project and check that there is a folder named 'org.apache.cordova.inappbrowser' or 'org.apache.cordova.core.inappbrowser' inside.

To install the InAppBrowser plugin (if necessary)...

Using Cordova: cordova plugin add org.apache.cordova.inappbrowser

Using PhoneGap: phonegap local plugin add org.apache.cordova.inappbrowser

From your description, it sounds like your page is opening within the app's webview, instead of the InAppBrowser window. This is the behaviour you would normally get if you used '_self' instead of '_blank'. Hopefully something here will help fix it.

这篇关于PhoneGap 3.0 InAppBrowser - 无法让用户关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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