停止页面出现在浏览器历史记录中 [英] Stop page from appearing in browser history
问题描述
我有一个简单的流程:
I have a simple flow:
A.html -> B.html -> C.html
现在,页面 B 302(暂时重定向302重定向代码)到页面 C ,或者它显示一个进度条;那么在ajax调用完成后,它会重定向到 C 页面。当用户在 C 上时,他们点击返回,我希望他们最终在 A 而不是 B 。
Now, page B either 302's (temporarily redirects giving 302 redirect code) to page C, or it shows a progress bar; then, after an ajax call is done, it redirects to page C. When the user is on C, and they hit "Back" I want them to end up on A instead of B.
如果页面执行了302重定向,则返回行为就是我想要的。否则,他们会获得该中间页面。有什么办法可以很容易地解决这个问题?
If the page did the 302 redirect, then the back behavior is what I want. Otherwise they get that intermediary page. Is there any way to solve this easily?
推荐答案
假设Ajax完成,您正在使用:
Presumably when the Ajax is done you are using:
location.href = "http://example.com/c";
将其更改为:
Change that to:
location.replace("http://example.com/c");
这篇关于停止页面出现在浏览器历史记录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!