将 url 更改为哈希片段变体
它看起来不像简单的哈希pushState,因为它确实改变了整个url。
没有页面刷新+它通过将其全部切断并将其作为哈希片段再次推送到 url 来完全更改 url。请查看下面的示例。
访问例如网址: http://www.couverts.nl/restaurant/13233 /jo-van-den-bosch/den-bosch
立即更改为: http://www.couverts.nl/# /restaurant/13233/jo-van-den-bosch/den-bosch
有人知道这里使用的技术吗?也许有人可以举一个简单的例子来说明如何实现它。
It doesnt look like simple hashing pushState since its really changing the whole url.
There is no page-refresh + it is totaly changing the url by cutting it all off and pushing it to the url again as a hash fragment. Please checkout the example below.
visit for example the url:
http://www.couverts.nl/restaurant/13233/jo-van-den-bosch/den-bosch
which instantly gets changed to:
http://www.couverts.nl/#/restaurant/13233/jo-van-den-bosch/den-bosch
Anyone know the techinque used here? And maybe someone can give a simple example of how to implement it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也在密切关注这个问题:Apache 重写指令怎么样?一个快速而肮脏的方法是:
然后
index.php
读取路径做一些工作并简单地将标头发送到客户端这背后的整个想法当然是 AJAX 和前端控制器模式。
PS:我刚刚重写了 Quentin Zervaas 所著《Practical Web 2.0 Applications with PHP》一书中与 Zend_Controller 类相关的第 2 章“将所有请求定向到 index.php”中的一些 Apache 指令...
I'm also looking close to this issue: what about Apache rewrite directives? A quick and dirty one would be:
and then
index.php
reads the path do some work and simply sends a header to clientThe whole idea behind this is of course AJAX and the Front Controller pattern.
PS: I've just rewritten some Apache directives from "Directing All Requests to index.php" of Chapter 2 related with the Zend_Controller class from the book "Practical Web 2.0 Applications with PHP" by Quentin Zervaas...
在不刷新页面的情况下更改 URL 使用了非常新的历史记录 API,主要是 history.replaceState
本杰明·巴勒普顿(Benjamin Balupton)写了非常好的history.js
我也邀请您检查整个规范:http://dev.w3.org/html5/spec/history.html
仅更改
location.hash
是这里的简单部分。Changing the URL with no page refresh uses the very new history API, mostly history.replaceState
Benjamin Balupton has written the very good history.js
And I invite your to check the whole specifications too: http://dev.w3.org/html5/spec/history.html
Changing only the
location.hash
is the easy part here.