如何跟踪同一用户/浏览器发起的单独会话
我有一个 Web 应用程序,用户可以从多个不同的页面进入该应用程序,并在该应用程序中遵循多个不同的路径。我希望能够在每个页面添加一个返回开始按钮,用户可以单击该按钮将他们带回到他们输入应用程序的页面。
目前用户是通过 cookie 进行身份验证的,因此我可以看到 cookie 是在哪个页面上生成的,并使用后退按钮的链接。但是,用户通常会在应用程序中打开多个选项卡并通过多个条目页面进行输入,我希望每个选项卡都能够将用户引导回正确的条目页面。
即用户在第 1 页输入应用程序,然后浏览到第 2 页 - 后退按钮应链接到第 1 页
用户然后在第 3 页打开另一个选项卡并浏览到第 4 页 - 此处的后退按钮应链接到第 3 页
。如果用户返回到选项卡 1 并浏览到第 5 页,则后退按钮仍应链接到此处的第 1 页,而其他浏览器中的后退按钮应链接到第 3 页。
我能想到的唯一方法是存储会话 ID在 get/post 请求中并将其传递到每个页面上 - 其他人能想到更简单或更优雅的解决方案吗?
谢谢,
汤姆
I have a web application which a user can enter from a number of different pages and follow a number of different paths through the application. I want to be able to add a back to start button to each page which the user can click to take them back to the page they entered the application at.
Currently the user is authenticated by cookie, so I can see what page the cookie is generated on store this and use the link for the back button. However, it is common for a user to open multiple tabs with the application in and enter through multiple entry pages and I want each tab to be able to direct the user back to the correct entry page.
I.e. the user enter the application at page 1 then browses to page 2 - the back button should link to page 1
The user then open another tab at page 3 and browses to page 4 - the back button here should link to page 3.
At this point if the user goes back to tab 1 and browses to page 5 the back button should still link to page 1 here and the back button in the other browser should link to page 3.
The only way I can think of to do this is store the session ID in the get/post request and pass it on every page - can anyone else think of an easier or more elegant solution?
Thanks,
Tom
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看
$_SERVER['HTTP_REFERER']
的文档问题:如果他从谷歌重定向......
另外:您可以硬编码一个检查域的函数:-)
Look at the documentation for
$_SERVER['HTTP_REFERER']
Problem: if he is redirected from google...
Plus:you can hardcode a function that checks the domain :-)