cordova 加载网页失败,出现错误:帧加载中断

bsxbgnwa  于 2022-11-15  发布在  其他
关注(0)|答案(2)|浏览(220)

我知道以前有人问过这个问题,但我没有看到任何解决方案:
因此,我使用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/

在我的Mac上,Chrome浏览器中一切都按预期运行。
我不知道这里发生了什么!!

ojsjcaue

ojsjcaue1#

该死的这腰分很多时间,答案是如此愚蠢和简单。
而不是将html中的链接设置为:

/#/foo/bar/

它应该只是

#/foo/bar/

这是有道理的,与前导/页面将重新加载,这就是为什么我得到了这个错误。
希望能帮到一些人

dgtucam1

dgtucam12#

我可以通过使用window.location.hash来解决这个问题。

相关问题