Phonegap navigator.app.backHistory / window.history.back 不适用于 Blackberry Playbook
在黑莓剧本上,正常 window.history.back 不起作用。在模拟器上进行了测试......
所以,我在index.html中尝试了这一点,
window.history.back = navigator.app.backHistory;
这为Phonegap函数提供了控制权,但在运行时它会抛出一个错误:
"Error: Status=2 Message=Class App cannot be found"
这是Phonegap(1.4.1)函数:
/**
* Navigate back in the browser history.
*/
App.prototype.backHistory = function() {
// window.history.back() behaves oddly on BlackBerry, so use
// native implementation.
console.log("in backHistory");
PhoneGap.exec(null, null, "App", "backHistory", []);
};
有任何线索吗?
On the Blackberry playbook, the normal
window.history.back does not work. Tested on the simulator....
So, I attempted this in the index.html
window.history.back = navigator.app.backHistory;
This gives control to the Phonegap function, but at run time it throws an error:
"Error: Status=2 Message=Class App cannot be found"
Here is the Phonegap (1.4.1) function:
/**
* Navigate back in the browser history.
*/
App.prototype.backHistory = function() {
// window.history.back() behaves oddly on BlackBerry, so use
// native implementation.
console.log("in backHistory");
PhoneGap.exec(null, null, "App", "backHistory", []);
};
Any clues?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以编写一个通用的后退函数,而不是覆盖 window.history.back,该函数可以根据定义的函数进行操作:
我不确定这是否回答了您的问题,但我一直在使用这种方法来在两个移动设备上进行测试和桌面浏览器。
Instead of overwriting window.history.back, you could write a generic back function that can act depending on which function is defined:
I am not sure if this answers your question, but I have been using this approach to enable testing on both mobile devices and desktop browsers.