简体   繁体   中英

How to handle deleting a resource and the user navigates back

I tried searching, but I'm not sure what terms to use to come up with something relevant. If I'm looking at an HTML resource, and I have the ability to delete the resource within the webapp, then I am redirected to the home page. However, the user can still press the back button in the history. What is the recommended way of handling this? Do I redirect to the home page again, show a 404, or use some other status code?

Show a 404. The resource doesn't exist now, so don't try to do anything useful. The only reason they'd press back is to do so again and get to the page they were on before that deleted resource.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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