Session delay lost at window.location.replace

I have a booking application developed using AngularJS that creates user booking details through various pages. This data is stored using SessionStorage (I want to avoid LocalStorage).

When the user goes to the payment page, I generate a PayPal token using a REST call, and then redirect them to PayPal.

The code I use for this redirect 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 content of SessionStorage has been cleared - but it only seems to be on mobile devices, I cannot replicate it to Chrome on the desktop.

Why is cleaning up SessionStorage cleared?

I understand that since I am not opening a new page (I am simply redirecting), the state must be maintained. The documentation I read says that SessionStorage clears when the window is closed - is that no different from redirecting?

Is there a way to redirect to PayPal while keeping SessionStorage on return?

+4
source share
1 answer

I created a simple test application that added an item to SessionStorage and used location.replace to go to PayPal, which brought me back to another page in the application.

As a result, SessionStorage was saved!

It turns out that some code was applied to the application that cleared SessionStorage, the secret was solved.

0

Source: https://habr.com/ru/post/1648780/


All Articles