Backbone.js的原因错误只在IE7 [英] Backbone.js cause bug only in IE7

查看:434
本文介绍了Backbone.js的原因错误只在IE7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的深化发展与后端和Backbone.js的在前端codeIgniter一个Web应用程序。
我还使用HTML5样板作为我开始的模板。

I'm developping a web app with CodeIgniter on back-end and Backbone.js on front-end. I'm also using HTML5 Boilerplate as my start template.

我使用的骨干控制器与历史通过我的应用程序主导航。我已经做到了在过去一年的时间,一切都做工精细。问题是,当我开始hashchange事件捕获与Backbone.History.start(),点击一个链接example.com/#home,在URL中的散列变化,在事件被触发,但在2秒后,哈希被清除从URL和JavaScript错误是只扔在IE7中。

I'm using Backbone's Controller and History as main navigation through my application. I've done it one time in the past and everything have work fine. The problem is, when i start hashchange event capture with Backbone.History.start() and click on a link example.com/#home, the hash change in the url, the event is fired but 2 seconds after, the hash is cleared from url and an javascript error is throw only in ie7.

我已经看一看源$ C ​​$ c和hashchange事件通过创建一个IFRAME运行的时间间隔来检查散列值的变化在IE7中acheived。

I've take a look at source code and hashchange event is acheived in IE7 by creating an IFRAME running an interval to check hash value change.

任何人都收到了这个奇怪的错误,并知道如何解决这个问题?

Anyone had this weird bug before and know how to solve this?

推荐答案

来处理与骨干网的#hash基本应用程序的正确方法似乎Backbone.history.saveLocation(散)和之后Backbone.history.loadUrl()来启用控制器的路由。

The right way to handle an #hash base application with Backbone seems to Backbone.history.saveLocation( hash ) and after Backbone.history.loadUrl() to enable Controller's routing.

韦思我以前就知道这...
有乐趣与这真棒MVC库:)

Whish i knew this before... Have fun with this awesome MVC library :)

这篇关于Backbone.js的原因错误只在IE7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆