停止页面出现在浏览器历史记录中 [英] Stop page from appearing in browser history

查看:124
本文介绍了停止页面出现在浏览器历史记录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的流程:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆