A link opened in a new window does not recognise that user is logged in

Hi, I am have a few pages, which I want to show only to logged in users with a particular role. So I have some validation code at the time of opening the page. This validation works well.

The problem is that if a logged in user clicks a button to open another restricted page, I am opening it in a new window. The page loads in the new window. But the new window does not recognise that the user is logged in or any other session data that I have stored. Is there a way to open the link in a new window and retain information of the loggedIn member?

You will have to send the data to the new page aswell.
Use wix-local-storage for this.
https://www.wix.com/velo/reference/wix-storage/local

Thanks for this, @russian-dima . However the issue is that the user is also not recognised as logged In in the new page. So will sending data through local serve the purpose?

How i would solve the problem…

  1. You are on site-A and click a button to be redirected to site-B.
  2. But Site-B is just for special user, with a special role (just for VIPs).
  3. OK. Now you have two options on this point.
    a) Query before redirect, or (b) query on site-B for user-details.

What would be the better way, what do you think?

I would take way-A, because it is has more performance and less loading time.

So, that menas, when you click onto a button a process starts, which should find out who is logged in and which role this user has, right?

Or would it even be better to get user-infos directly when site-A loads (isReady) ?

Yes of course it is.

So at the end, site-A should know the user-details, when clicking onto the button. When USER is NOT a VIP —> no redirect to site-B, but if USER is a VIP —> redirect to site-B (to the VIP-site).

Is this the flow which you wanted to create?