简体   繁体   English

重新加载后如何将数据保留在页面中?

[英]how to keep data in page after reload?

I have a page which loads a login page, after the user logged in it will load some parts of another file into itself. 我有一个页面可加载登录页面,在用户登录后该页面会将另一个文件的某些部分加载到自身中。 The problem is that I want to know which button is pressed in the first page and have it in the login page. 问题是我想知道在第一页中按下了哪个按钮,并将其放在登录页面中。 The first page loads login page using location.window and it refreshes the page. 第一页使用location.window加载登录页面,并刷新该页面。 Is there a way to do this? 有没有办法做到这一点?

另外,您可以利用cookie / HTML5 localStorage来跟踪页面URL。

If you are using FORM then you can send the button information in hidden field, like 如果您使用的是FORM,则可以在隐藏字段中发送按钮信息,例如

<input type="hidden" name="track" value="but1">

or if you are using GET method, you can send the info by query string, like 或者,如果您使用的是GET方法,则可以通过查询字符串发送信息,例如

http://domain/login.php?track=but1

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

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