Hello Imacklin,
well first at all, please do not use pics to show your CODE!
It is better for all to have the CODE inside a “CODE-TAG”, which you will find here…

I am not sure, but i think you have a failure in your “onReady”-code part.
You do GET before you SET!
First SET —> then ----> GET !
$w.onReady(function(){
session.setItem("page", wixLocation.url);
previousPageURL = session.getItem("page");
});
I think this will cause the error in your code.