我可以设置页面的位置,而不实际刷新/重新加载它吗?

发布于 2024-11-19 17:50:51 字数 356 浏览 4 评论 0原文

问题:

我可以设置页面的位置,而不实际刷新/重新加载它吗?

问题:

我的问题是页面是通过 get 变量 page.html?userid=12345 加载的。

关键是页面上可编辑的字段之一,并且提交使用 jQuery .post,因此页面地址永远不会改变。

但是,如果他们此时按下刷新,则该 url 将指向不存在的用户 ID。

我想将位置设置为 userid=12345,但没有实际检索该 URL(因为我想保留我的 jQuery 修改页面)。

这似乎存在安全/网络钓鱼风险,所以我怀疑这是不可能的。

Question:

Can I set the location of a page, without actually refreshing/reloading it?

Problem:

My problem is the page is loaded via a get variable page.html?userid=12345.

The key is one of the fields editable on the page, and the submit is using jQuery .post, so the page address never changes.

However, if they press refresh at this point, the url is pointing to a non-existent userid.

I want to set the location to userid=12345, but without actually retreiving that URL (cause I want to retain my jQuery modified page).

This seems like a security/phishing risk, so I suspect this is not possible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听风念你 2024-11-26 17:50:51

如果您不介意没有最好的浏览器支持并且域将匹配,请使用 history .pushState()

If you don't mind not having the best browser support and the domain will match, use history.pushState().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文