问题描述
我已经使用 CakePHP 完成了一个预订应用程序,它在结帐页面之前涉及几个步骤.在这些步骤之间,我将信息存储在会话中.
I've done a booking application done using CakePHP which involves a few steps before the checkout page. In between these steps I store the information in the session.
它的工作原理是第 1 步要求他们填写信息.进入步骤2时,步骤1中的信息将保存到会话对象中.当他们继续执行其他步骤时,该过程会重复.最后结账时,所有数据都保存到数据库中.
How it works is that Step 1 requires them to fill in their information. When going to Step 2, the information in Step 1 will be saved into the session object. As they proceed in the other steps, the process repeats. At the end when they checkout, all the data is then saved to the database.
如果用户在浏览器中打开应用程序的一个实例,一切都会很好.但是一旦他们在同一个浏览器中为同一个应用程序打开另一个页面或另一个选项卡,就会出现问题.
Everything works great if the user opens one instance of the application in the browser. But once they have another page or another tab opened for the same application in the same browser, problem happens.
假设他们在 Tab A 和 Tab B 中打开了应用程序的两个实例.在 Tab A 中,他们输入了第 1 步中的详细信息并继续执行第 2 步.然后用户在 Tab B 中执行相同的操作.
Let's say they have two instance of the application open in Tab A and Tab B. In Tab A they entered the details in Step 1 and proceed to Step 2. Then the user does the same thing in Tab B.
最后一步,当用户结账时,Tab A 中的信息与 Tab B 中的信息相同.
At the last step when the user does a checkout, information in Tab A is the same as in Tab B.
现在,我只能认为最好的方法是防止用户在两个浏览器实例中打开同一个应用程序.
Right now, I can only think the best way is to prevent the user from opening the same application in two browser instance.
当用户尝试在 Tab B 中打开另一个实例时,有没有办法检测并提示他们先在 Tab A 中填写预订表格?
Is there a way to detect and prompt the user to complete the booking form in Tab A first when they try to open another instance in Tab B?
推荐答案
1.同样的问题(和解决方案):https://sites.google.com/site/sarittechworld/track-client-windows
1.The same problem (and solution) : https://sites.google.com/site/sarittechworld/track-client-windows
2.您可以通过POST或GET方式发送信息
2.You can send information by POST or GET
这篇关于如何检测用户是否为同一个会话打开两个选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!