我看到这个问题之前已经问过了,但我没有看到任何解决方案:
所以我使用Cordova 2.5在iOS 6.1.2上构建一个iPad应用
我app.coffee:
jQuery ->
class window.AppRouter extends Backbone.Router
routes: {
'': 'index',
':parent/:child/': 'childView',
':id/': 'detailView',
},
index: =>
$("#navbar .title").text("Flight Centre's Choices")
view = new fc.main.View
view.render()
childView: (parent, child) =>
view = new fc.main.View(parent:parent, child:child)
view.render()
detailView: (id) =>
view = new fc.main.Detail(id:id)
view.render()
window.app = new AppRouter();
Backbone.history.start();
第一个索引视图成功加载并显示
现在点击其中一个链接比如打开childView,它无法加载页面
2013-03-20 16:56:13.684 Flight[1158:907] Resetting plugins due to page load.
2013-03-20 16:56:13.689 Flight[1158:907] Resetting plugins due to page load.
2013-03-20 16:56:13.694 Flight[1158:907] Failed to load webpage with error: Frame load interrupted
用户点击的链接看起来像这样':
/#/foo/bar/
Chrome浏览器在我的mac上一切正常。
我不知道这里发生了什么!!他妈的浪费了这么多时间,答案是如此愚蠢和简单。
而不是将html中的链接设置为:
/#/foo/bar/
应该是
#/foo/bar/
这是有意义的,与前导/页面将重新加载,这就是为什么我得到这个错误。
希望对大家有所帮助
我可以使用window.location.hash