移动设备的后退按钮不起作用 -backbone.js 0.5.3 和 jquerymobile 1.0 RC2
当使用带有 triggerRoute = true;
的导航方法时,页面可以正常导航到新页面,但历史记录不会更新。
当点击 Android 设备 (Nexus S) 上的后退按钮时,历史记录会弹出,但导航不会发生。
如果我为 triggerRoute
传递 false
,然后调用 Backbone.history.loadUrl();
那么后退按钮确实可以工作,但有点不稳定。
导航方法有这样的评论...
// URL-encoding the fragment in advance. This does not trigger
// a `hashchange` event.
阅读了几篇文章后,在我看来,使用导航方法是正确的方法,应该更新历史记录...
代码片段...
er.getApp().getController().navigate('home', true);
或者
er.getApp().getController().navigate('home');
Backbone.history.loadUrl();
jquerymobile 是否存在已知的路由问题和骨干组合。这里较旧的答案与骨干.js 的早期版本相关,并且不再有效......
When using the navigate method with triggerRoute = true;
the page navigates fine to the new page but history is not updated.
When hitting the back button on an Android device (Nexus S), the history pops, but the navigation does not happen.
If I pass false
for the triggerRoute
and then call Backbone.history.loadUrl();
Then the back button does work but sort of erratically.
The navigate method has this comment ....
// URL-encoding the fragment in advance. This does not trigger
// a `hashchange` event.
After reading several posts, it seems to me that using the navigate method is the right way and should update the history...
Code snippet ...
er.getApp().getController().navigate('home', true);
OR
er.getApp().getController().navigate('home');
Backbone.history.loadUrl();
Is there a known routing issue with jquerymobile and backbone combination. Older answers here relate to earlier version of backbone.js and are not valid anymore ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的。找到了解决办法。基本上告诉
jquerymobile
不要对后退按钮和hashchange
事件执行任何操作,并让backbone完全处理它。在index.html的appLoading事件处理程序中,有将Jquerymobile绑定到后退按钮的代码,将其删除。
Ok. Found a resolution. Basically tell
jquerymobile
not to do anything with the back button andhashchange
event and let backbone handle it completely.In the index.html, appLoading event handler, there was code binding Jquerymobile to the back button, removed it.