在 Phonegap InAppBrowser 上处理 Android 后退按钮

我想在 InAppBrowser 上导航页面时禁用或覆盖 Android 后退按钮.我可以添加一个可以处理的事件侦听器吗?

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?

查看@T_D 下面提供的解决方案的答案是我能得到的最接近的答案.似乎不可能覆盖 InAppBrowser 中的按钮,因为在此插件上导航页面时所有 PhoneGap 调整都停止工作.除了修改 API 库之外,我找不到任何其他解决方案.如果这里有任何 PhoneGap 人并且了解更多信息,我会很高兴得到一些评论.谢谢.

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.

我得到的最近的:

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



 1 条回答

var ens=document.querySelectorAll('.showen'); ens.forEach(function(item,index){ item.onclick=function(){ item.parentNode.nextElementSibling.style.display = "block"; } })