+ 12
Html form submission
after submitting a form and the user is on another page, if the user goes back to previous page how can I prevent the user from going back to the form
22 Respostas
+ 11
I understand your question Daya Bianca, you can do that by making the former page url expire, which is used by mist banks website, you can also use javascript to delete former page history.
you can replece history, instead of using window.location = url; to redirect,
try:
window.location.replace(url);
after using replace() the current page will not be saved in session history, meaning the user won't be able to use the Back button to navigate to it, bcoz after loading the page the history is replace with another url.
replaceState may also help.
This links may help also:
https://stackoverflow.com/questions/37511043/how-to-stop-re-submitting-a-form-after-clicking-back-button
https://www.the-art-of-web.com/javascript/doublesubmit/
https://www.w3schools.com/js/js_cookies.asp
+ 5
The submit of your form i.e. as follows:
function withoutBack() {
location.replace('http://www.myNewUri');
}
+ 5
Web is not something I am very knowledgable about. If you only use one page with divisions getting updated, back will take them off your site so no issue.
+ 5
A simple php session will do.
You don't need to learn much.
Start a session at the top of your page before any html using session_start(); and store data with $_SESSION
Any other page that has session started will be able to access that data
https://www.w3schools.com/php/php_sessions.asp
+ 5
Abdulazeez
You can create links as usually to other websites.
This do not work here on SL Playground. So you have to use another web server.
Next time please ask in you own thread.
+ 4
The location.replace(URL_2); method replace browser historyās last page URL_1 = āwhere is/was your form with questionsā with the web page URL_2. An example:
<input id="myIn">
<button type="button" onclick="validateIn(this)">submit</button>
<script>
function validateIn() {
var x = document.getElementById("myIn").value;
if (x == "") {
alert("This must be filled out");
return false;
}
location.replace('https://www.sololearn.com/');
}
</script>
+ 4
Ja Play, the code can't be placed here, I am dealing with more than 1 web page, which sololearn code playgroubd does not support
+ 3
Seniru how can I use cookies
+ 3
I had a question like that
+ 2
Instead the user should go to another page
+ 2
Which I will redirect the user myself
+ 2
Ja Play pls how does the location.replace works
+ 2
+ 2
I hope you are okay with my answer Daya Bianca
+ 2
looking for team members to start a project with..
+ 2
kel Mar am interested
+ 2
kel Mar I'm interested
+ 1
Not sure, but maybe cookies is the answer
+ 1
Thanks Awojobi Godfrey, understood now
+ 1
How do you create content of the page you want users to navigate to for multipage websites??
Pls,I need help... for local files/webpage