简体   繁体   English

在history.go(-1)上传递变量

[英]Passing variables on history.go(-1)

Is it in any way possible what I have in mind, without the use of Javascript frameworks?! 不使用Javascript框架,是否有可能实现我的构想?!

On page a.php set some values in a form with input fields, and I upload a file to b.php. 在页面a.php上,使用输入字段在表单中设置一些值,然后将文件上传到b.php。 After uploading I do a check via a shell_exec(); 上传后,我通过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. 如果页面数量与a.php的输入type = text字段中输入的页面数量不一致。

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. 如果a.php中设置的页面数量不等于b.php中检测到的页面数量,我将使用javascript history.go(-1)返回上一页,因此输入的所有值均保持原样。

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. 现在我想要的是使用history.go(-1),我可以将值(页面的实际数量)传递给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. 您无法使用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 您可以做的是使用Cookie或本地存储来存储值并读取另一页的页面加载事件中的值

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

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