简体   繁体   English

浏览器的后退按钮返回自定义网址列表?

[英]browser back button go back follow a custom url list?

I have seen history.js , it seems just work on current page: 我看过history.js ,似乎只在当前页面上有效:
such as: 如:

www.mysite.com
www.mysite.com/?state=1
www.mysite.com/?state=2
www.mysite.com/?state=3
www.mysite.com/?state=4
www.mysite.com/?state=3

It can make back button back follow state from large to small only on the same page. 仅在同一页面上,它可使后退按钮从大到小跟随状态。


What I want is: 我想要的是:

www.mysite.com/center/?state=1
www.mysite.com/product-list/?state=2
www.mysite.com/product-detail-manage-form/?state=3

center can not return to product-list , and product-list can not return to product-detail-manage-form . center不能返回到product-list ,并且product-list不能返回到product-detail-manage-form

Because a user can edit or delete a product at product-detail-manage-form page, and server will redirect he to product-list page after form submit. 因为用户可以在product-detail-manage-form页面上编辑或删除产品,并且服务器将在表单提交后将其重定向到product-list页面。
I don't want he return to product-detail-manage-form by clicking back button on product-list page. 我不希望他通过单击“ product-list页面上的“后退”按钮返回到product-detail-manage-form
Is there any easy way to achieve my purpose? 有什么简单的方法可以实现我的目的?

Try using javascript to manipulate the browser history: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history 尝试使用JavaScript处理浏览器历史记录: https : //developer.mozilla.org/zh-CN/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

This way you can control the history stack and which pages the users can get to using the back button 这样,您可以控制历史记录堆栈以及使用后退按钮用户可以访问哪些页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM