Unable to get value from one page and pass it to another

Question:
I am unable to pass a value from one page and get it in another. I followed the code given in a similar question on this forum but it doesn’t work for me. Please see my code below.
Basically, on page 1 if they click “disabsent” button it shud store value 0 and if they click on “dispresent” button it should store 1.
Based in this on page 2 it should check for the stored items and if it is 0 display a certain image and if it is 1 display another image.

Page 1
import {session} from ‘wix-storage-frontend’;
$w.onReady (async function () {

$w('#disabsent').onClick( () => {
session.setItem("absent","0"); 
});
$w('#dispresent').onClick( () => {
session.setItem("present", "1"); 
});    

});

Page 2:
import {session} from ‘wix-storage-frontend’;

$w.onReady(async function () {
let x =session.getItem(“absent”);
console.log(x)
let y =session.getItem(“present”);
console.log(y)
if (x = “0”) {
setTimeout(() => {
$w(‘#imageX2’).show();
$w(‘#imageX3’).hide();
}, 8000);

}
else if (y = "1") {
setTimeout(() => {
    $w("#box2").show();
}, 10000);
}

});

Product:
Wix Studio

session only works for a single browser window/tab and not across windows/tabs. You may want to try local storage instead: local - Velo API Reference - Wix.com

1 Like