跳过位置被推送到浏览器导航历史记录堆栈
假设以下场景:
- 用户在产品列表页面上
- 单击产品并重定向到产品详细信息页面
- 单击购买按钮
POST /products/1/purchase/
被执行并重定向回产品详细信息页面- 用户单击后退按钮
POST /products/1/purchase/
再次执行(失败!它应该被重定向到产品列表页面)
您将如何解决后退按钮问题? 是否有任何响应代码强制浏览器从历史堆栈中跳过该位置?
假设我可以实现自己的后退按钮,您将如何实现它?
- 手动跟踪历史记录,客户端
- 手动跟踪历史记录,服务器端
- 设置检查点并在检查点存在时重定向回该检查点
Assuming the following scenario:
- User is on product list page
- Clicks a product and is redirected to the product detail page
- Clicks on purchase button
POST /products/1/purchase/
is executed and redirects back to product detail page- User clicks back button
POST /products/1/purchase/
is executed again (FAIL! it should have been redirected to product list page)
How would you solve the back button problem?
Is there any response code that forces the browser to skip the location from history stack?
Assuming I can implement my own back button, how would you implement it?
- Manually tracking the history, client-side
- Manually tracking the history, server-side
- Setting checkpoints and redirecting back to the checkpoint in case of existence
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅:
后退按钮重新提交表单数据 ($_POST)
See:
Back button re-submit form data ($_POST)