I have a booking application developed using AngularJS that is building up details of the users booking through various pages. These details are stored using SessionStorage (I want to avoid LocalStorage).
我有一个使用AngularJS开发的预订应用程序,它正在构建通过各种页面预订的用户的详细信息。这些细节使用SessionStorage存储(我想避免使用LocalStorage)。
When the user gets to the payment page, I generate a PayPal token using a REST call and then redirect them to PayPal.
当用户进入付款页面时,我使用REST调用生成PayPal令牌,然后将其重定向到PayPal。
The code I'm using for this re-direct is:
我用于此重定向的代码是:
window.location.replace("https://www.sandbox.paypal.com/checkoutnow?useraction=commit&token=XXX&ul=0#/checkout/login");
When PayPal sends me back to my confirmation page the contents of SessionStorage have been cleared - but this only seems to happen on mobile devices, I can't replicate it with Chrome on desktop.
当PayPal将我发回我的确认页面时,SessionStorage的内容已被清除 - 但这似乎只发生在移动设备上,我无法在桌面上使用Chrome进行复制。
Why does the SessionStorage get cleared?
为什么SessionStorage会被清除?
My understanding is that because I'm not opening a new page (I'm just re-directing) the state should be persisted. Documentation I have read says that SessionStorage is cleared when the window is shut - does this not differ from a redirect?
我的理解是,因为我没有打开一个新的页面(我只是重新指导),所以应该保持状态。我读过的文档说当窗口关闭时会清除SessionStorage - 这与重定向没有区别吗?
Is there a way to redirect to PayPal whilst persisting SessionStorage on return?
有没有办法在返回时持久化SessionStorage时重定向到PayPal?
1 个解决方案
#1
0
I created a simple test application that added an item to SessionStorage and used location.replace to go to PayPal which returned me back to another page in the application.
我创建了一个简单的测试应用程序,它将一个项目添加到SessionStorage并使用location.replace转到PayPal,后者将我返回到应用程序中的另一个页面。
The result was that SessionStorage was persisted!
结果是SessionStorage持续存在!
Turns out some code had been committed to the application which was clearing SessionStorage out, mystery solved.
原来一些代码已经提交给正在清理SessionStorage的应用程序,神秘解决了。
#1
0
I created a simple test application that added an item to SessionStorage and used location.replace to go to PayPal which returned me back to another page in the application.
我创建了一个简单的测试应用程序,它将一个项目添加到SessionStorage并使用location.replace转到PayPal,后者将我返回到应用程序中的另一个页面。
The result was that SessionStorage was persisted!
结果是SessionStorage持续存在!
Turns out some code had been committed to the application which was clearing SessionStorage out, mystery solved.
原来一些代码已经提交给正在清理SessionStorage的应用程序,神秘解决了。