简体   繁体   中英

Passing variables on history.go(-1)

Is it in any way possible what I have in mind, without the use of Javascript frameworks?!

On page a.php set some values in a form with input fields, and I upload a file to b.php. After uploading I do a check via a shell_exec(); through another piece of software that allows me to detect the amount of pages that this file contains. If the amount of pages is not consistent with the amount of pages that has been entered in an input type=text field in a.php.

If the amount of pages set in a.php is not equal to the amount of pages detected in b.php, I use a javascript history.go(-1) to return to the previous page, so all values entered remain in tact.

Now what I want is that with the history.go(-1) I can pass a value (the actual amount of pages) to an input text field in a.php.

Can this be done in any way, say with the use of an event handler? If so, how?

You can't pass a variable using history.go. This function is equivalent to the user pressing the back button. What you could do is use cookies or local storage to store values and read those in the page load event of the other page

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