【问题标题】:URL with the current query当前查询的 URL
【发布时间】:2012-08-09 03:06:27
【问题描述】:

我有一个 AJAX Web 应用程序,我希望在其中使用 URL 来反映当前查询的内容,以便获得“永久链接”。例如,用户在搜索输入中输入“foobar”作为查询,然后 URL 栏中的 http://example/search/ 会更新为 http://example/search/?foobar

当尝试使用 index.html 实现这一点时:

<script>
query = "foobar";
window.location.search = query;
</script>

首先,这奇怪地使浏览器陷入无限循环。我错过了什么?

【问题讨论】:

标签: ajax url history permalinks


【解决方案1】:

更改window.location 会使浏览器重新加载该页面。

【讨论】:

    猜你喜欢
    • 2018-09-09
    • 2016-12-31
    • 2019-06-01
    • 2018-09-04
    • 2021-06-25
    • 2014-12-21
    • 2012-03-31
    • 1970-01-01
    • 2015-09-16
    相关资源
    最近更新 更多