gpt4 book ai didi

javascript - HTML:在不重新加载页面的情况下更改 URL?

转载 作者:搜寻专家 更新时间:2023-10-31 22:04:12 25 4
gpt4 key购买 nike

查看此链接:

http://google.blogspot.com/view/timeslide

然后单击该帖子,您可以看到 URL 正在更改但没有 # 或类似内容,它的更改就像页面正常加载一样,但内容的更改就像使用 AJAX 构建一样。

这发生在 Chrome 10 的最新稳定版本中,但对于 Firefox 3.6,它使用带有哈希的旧方法:)

这怎么可能,这是一个新的 HTML5 特性还是什么?

最佳答案

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

关于javascript - HTML:在不重新加载页面的情况下更改 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5525636/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com