2013-03-20 80 views
12

我看到这个已经被问过,但我没有看到任何解决方案:失败,错误加载网页:框架加载中断

所以即时通讯使用科尔多瓦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/ 

一切正常在我的Mac上的Chrome浏览器。

我不知道这里发生了什么!

回答

33

该死的分配时间,答案是如此愚蠢和简单。

而不必在HTML中的链接为:

/#/foo/bar/ 

这应该只是

#/foo/bar/ 

这是有道理的,与领先/页面将重新加载,而这就是为什么我那个错误。

希望它可以帮助别人

+3

是的解决这个问题,有同样的问题与PhoneGap的3和AngularJS ......感谢上帝,谷歌! – 2013-12-06 00:33:17

+0

对于那些以后可能会出现的问题,这通过ng-href进行连接时没有*解决我的问题。在ng-click中通过方法调用调用$ location.path('/ route_name'),但是... Curiouser和curiouser ... – ericpeters0n 2014-05-07 22:16:25

+0

在我的情况下,我已经在所有链接中使用#/。即使我尝试了#/和/#/,唯一有效的工作是将链接保持原样并删除 Bernat 2017-02-15 16:02:14

0

我可以通过使用window.location.hash