手柄的Andr​​oid回的PhoneGap InAppBrowser按钮 [英] Handle Android Back Button on Phonegap InAppBrowser

查看:184
本文介绍了手柄的Andr​​oid回的PhoneGap InAppBrowser按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用或覆盖了Android后退按钮,当我浏览的InAppBrowser页面。我可以添加一个事件监听器,可以处理这个问题?

编辑: 看着被@T_D下面提供的解决方案的答案是最接近我能得到。它似乎并不有可能覆盖InAppBrowser的按钮,所有的PhoneGap调整停在浏览这个插件的网页的工作。我无法找到任何其他的解决方案,而不是修改API库。如果有任何PhoneGap的家伙在这里,知道更多的东西,我会很高兴得到一些评论。谢谢你。

我得到的最接近的:

  VAR REF =的window.open('http://apache.org','_blank','位置= YES');
ref.addEventListener(后退按钮,功能(){})
 

解决方案

按照文档后退按钮现在可以为InAppBrowser配置的硬件的行为:

  

hardwareback:设置为yes要使用的硬件后退按钮通过InAppBrowser的历史背景定位。如果没有previous页时,InAppBrowser将关闭。默认值是肯定的,所以你必须,如果你想后退按钮简单地关闭InAppBrowser将其设置为无。

由于克里斯埃里克森

因此​​,只要更新您的InAppBrowser的插件,如果向后导航所期望的行为。

有关详细信息,请参阅: https://github.com/apache/cordova -plugin-inappbrowser /拉/ 86

I would like to disable or override the Android Back button while I am navigating pages on the InAppBrowser. Can I add an event listener that can handle that?

EDIT: Looking at the answer by @T_D below the solutions provided are the closest I could get to. It does not seem to be possible to override the button in InAppBrowser as all the PhoneGap tweaks stop working while navigating pages on this plugin. I was not able to find any other solution rather than modifying the API library. If there are any PhoneGap guys here and know something more, I 'll be glad to get some comment. Thanks.

The closest I got:

var ref = window.open('http://apache.org', '_blank', 'location=yes');
ref.addEventListener("backbutton", function () { })

解决方案

According to the documentation the behaviour of the hardware back button can be configured now for the InAppBrowser:

hardwareback: set to yes to use the hardware back button to navigate backwards through the InAppBrowser's history. If there is no previous page, the InAppBrowser will close. The default value is yes, so you must set it to no if you want the back button to simply close the InAppBrowser.

Thanks to Kris Erickson.

So just update your InAppBrowser plugin if the backward navigation is the desired behaviour.

For more details see: https://github.com/apache/cordova-plugin-inappbrowser/pull/86

这篇关于手柄的Andr​​oid回的PhoneGap InAppBrowser按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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