在不支持(window.history && window.history.pushState)的浏览器上,jsbin通过window.location.hash = data.edit; (details here)修改url。
这将创建如下的urls
http://jsbin.com/#/imetor/1/edit如何让django的urls.py处理这样的url?I am not even sure that the hash is being sent to the server。如果它没有被发送到服务器,那么jsbin使用什么技术将这些参数传递给服务器?
FWIW,这不起作用:
url(r'^#/(?P<project_id>[0-9A-Za-z]{6,})', 'mysite.views.project_hash', name='project_hash'),发布于 2013-05-14 23:58:44
你是正确的。#之后的部分不会发送到服务器。
在django中,如果你想看到发送到服务器的url,你可以这样做
print request.get_full_path()在jsbin的情况下,服务器返回一个包含javascript代码的页面,然后读取url参数并执行代码以个性化页面。解析url并执行函数的javascript代码的一个例子是Backbone.Router (http://backbonejs.org/#Router)。
https://stackoverflow.com/questions/16547223
复制相似问题