主干航线没有哈希? [英] Backbone routes without hashes?

查看:98
本文介绍了主干航线没有哈希?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用骨干当前项目。我不知道是否有可能做路由,而不散列,像davis.js一样。

I'm using backbone for a current project. I was wondering if it's possible to do routing without hashes #, like davis.js does.

谢谢!

推荐答案

您需要启用pushState的

You need to enable pushState

Backbone.history.start({pushState的:真正})

http://backbonejs.org/#Router

http://backbonejs.org/#History

编辑:正如在评论中指出,这将仅对支持pushState的浏览器,不将回落到哈希方法浏览器。有解决这个没有真正的方法,您可以为现代浏览器和回落或只是使用散列对所有的浏览器。

As noted in the comments this will only work for browsers that support pushState, browsers that don't will fall back to the hash method. There is no real way around this, you can enable for modern browser and fall back or just use hashes for all browsers.

这篇关于主干航线没有哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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