开发者

Hashbang with Django

开发者 https://www.devze.com 2023-03-11 17:37 出处:网络
I\'m looking for having urls like http://example.org/!#/followers and http://example.org/!#/following in my django application.

I'm looking for having urls like http://example.org/!#/followers and http://example.org/!#/following in my django application.

All plugin like jquery history plugin, jQuery BBQ and others, teach how to have urls like this http://example.org/#followers and http://example.org/#following.

开发者_开发问答I want !#, is this possible?

Thanks.


Hash bangs are bad. Bad for your application and bad for the web. Use the pushstate api to achieve the similar effect in supported browsers. You can even use the awesome jquery-pjax

The part of the URL that is after # is not even sent to the server. In the page, you hookup the JS to send a AJAX request and load the particular div, from the real URL your server gives that content from.


First of all, a clarification ... do you want bang-hash (!#), or hash-bang (#!)? The latter is the common url scheme for AJAX-ified sites that Google uses to index varying states in a web application. However, it isn't something you can build into a Django URL scheme, because the hash signifies to the browser that what follows is a URL fragment, so it doesn't get sent the same way to your Django engine. It's really a structure for javascript (as you point out, jquery) rather than for any sort of backend processing.


I've solved with jquery-history.

0

精彩评论

暂无评论...
验证码 换一张
取 消