Phonegap/JqueryMobile 上 Blackberry 硬件后退按钮的行为不一致
我正在开发一个多页面 JqueryMobile(1.0) 应用程序并使用 Phonegap(1.3) 提供 WebView。我已经通过 stackoverflow 和网络代码来处理黑莓硬件后退按钮。
我在 jquerymobile 加载之前设置了 mobile.pushStateEnabled=false 。 我还使用以下功能设置了 config.xml 文件,
<feature id="blackberry.system" required="true" version="1.0.0.0" />
我尝试将以下代码片段放置在不同的位置。在标题/正文/所有页面中,但我仍然出现不一致的行为。 Phonegap 正在初始化,我什至尝试在 Phonegap 初始化后将其放入,但似乎没有任何效果。我什至尝试将其制作为一个 html 文件,所有页面都在一个文件中(jquery mobile)。应用程序要么退出,要么在某些情况下根本不响应,在极少数情况下会按预期运行。
<script>
blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK,
function() {
history.back();
return false;
});
</script>
我正在使用 Blackberry 9780(操作系统版本 6..0)进行部署,并尝试使用最新版本的 jquery-mobile(1.01) 和phonegap (1.4)。 任何指示将不胜感激。
I am developing a multi page JqueryMobile(1.0) App and using Phonegap(1.3) to provide the WebView. I have been through stackoverflow and the web on code to handle the blackberry hardware back button.
I have set the mobile.pushStateEnabled=false before jquerymobile loads.
I have also set the config.xml file with the following feature
<feature id="blackberry.system" required="true" version="1.0.0.0" />
I have tried placing the following piece of code at various places. In the header/body/in all pages but I continue to get inconsistent behavior. Phonegap is getting initialized and I have even tried putting it in after phonegap intiialization but nothing seems to work. I have even tried by making it a single html file with all pages in one file(jquery mobile). The app either exits or in some cases does not respond at all and in rare cases behaves as expected.
<script>
blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK,
function() {
history.back();
return false;
});
</script>
I am using a Blackberry 9780 (OS ver 6..0) to deploy and have also tried it with the latest versions of jquery-mobile(1.01) and phonegap (1.4).
Any pointers will be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个
并且不要忘记在 onReady 中添加 onLoad 函数
try this
and dont forget to add onLoad function in your onReady
我也有同样的问题。有时应用程序只是关闭,有时它可以工作,有时您必须按后退按钮几次。
尝试以下答案之一: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Back-button-in-BB-OS-5/mp/1611047
I also have the same problem. Sometimes the app is just closed, sometimes it works, sometimes you have to press the back button several times.
Try one of this answers: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Back-button-in-BB-OS-5/m-p/1611047