简体   繁体   中英

disable viewing past content/history in html

I've got an html from on a public access tablet. Is there a way to reliably prevent a user from going back in history to view past form submissions?

I'm looking to solve it either server-side or using javascript, or combination of the two.

I tried javascript code that prevent the back action, but it only works on the immediate back, press and hold to view further back options still allows going back.

The form is set to remember values when submission fails, but should not be able to get them after a successful submit.

is this perhaps better to do using sessions and handle using php?

There are many ways to prevent re-submission of forms through clicking the back button:

One way is to set all the form fields to be empty, this can be done on load of the page.

You could use sessions to ensure that the user has already submitted the form. Cookies and/or local storage can be used as well.

However, querying the database to check for duplicates or resubmissions, or setting the form fields to empty strings on the client side would be a better option, as a user could delete cookies and clear local storage.

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