Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

javascript - HTML: Changing the URL without reloading the page?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

pushState:

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...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...