HTML:更改网址而不重新加载页面? [英] HTML: Changing the URL without reloading the page?
问题描述
查看此链接:
http: //google.blogspot.com/view/timeslide
点击帖子,你可以看到网址正在改变,但没有#或什么的就像那样,它会像页面正常加载一样改变,但内容会像使用AJAX一样进行更改。
Chrome 10带有最新的稳定版本,但对于Firefox 3.6,它使用旧的方式与哈希:)
这怎么可能,这是一个新的HTML5功能或什么?
窗口。历史。 pushState(data,title [,url])
将给定的数据推送到会话历史记录中,使用给定的标题,以及(如果提供)给定的URL ...
用户代理必须运行以下步骤。 。
在克隆数据 /www.whatwg.org/specs/web-apps/current-work/multipage/history.html#current-entryrel =nofollow noreferrer>当前条目 >作为状态对象,给定的 title 作为标题,如果存在第三个参数,则绝对URL ,该算法在本算法中早先被发现为 URL 。
更新当前条目为新添加的条目...
Check out this link:
http://google.blogspot.com/view/timeslide
And click on the post and as you can see the URL is changing but without a # or something like that, It changes like the page would load normally, but the content changes just like it would be built with AJAX.
This happens with Chrome 10 with the latest stable version, but for Firefox 3.6 it uses the old way with the hash :)
How is this possible, is this a new HTML5 feature or what?
window . history . pushState(data, title [, url ] )
Pushes the given data onto the session history, with the given title, and, if provided, the given URL...
the user agent must run the following steps...
Add a state object entry to the session history, after the current entry, with cloned data as the state object, the given title as the title, and, if the third argument is present, the absolute URL that was found earlier in this algorithm as the URL of the entry.
Update the current entry to be the this newly added entry...
这篇关于HTML:更改网址而不重新加载页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!