Redirect to a page with a specific Statebox

How can I redirect the user to a specific page with a specific Statebox?

  1. wixLocation.to(“/page”)
  1. $w(“#mainStatebox”).changeState(“profile”);

Thanks

Hi Sivan,

You could utilize wix storage functions for this.

https://www.wix.com/corvid/reference/wix-storage.html#session
Before the redirect call, you could have some thing like this:

// this line at top of page
import {session} from 'wix-storage';

session.setItem("Statebox", "profile");
wixLocation.to("/page")

In the onReady event of the page redirected to, have something like this:

// this line at top of page 
import {session} from 'wix-storage';  

let state = session.getItem("Statebox");

$w.onReady(function () {
    // Some kind of logic to know if it should change the state
    if (state !== ""){
        $w("#mainStatebox").changeState(state);
    }
});