I have a problem with the local storage feature of JS I have two html pages and when you finish the game you get redirected to a reward page and a password it's passed via local storage to the second page, this worked well when the pages were on local host, after I uploaded online the local storage is not working. Here is the code for the first page:
localStorage.setItem('passw', "1234")
alert(localStorage.getItem('passw'));
location.replace("https://smartcup.online/BrandedGames/Voucher-10.html");
And here is the code for the second page (if no password is is local storage we get redirected to the first page)
alert(localStorage.getItem('passw'));
if(localStorage.getItem('passw') == null){
location.replace("https://www.smartcup.online/BrandedGames/HangMan/HangManGame.html")
}
The alert on the second page return null but I don't know why. I will leave the link of the page bellow to try it:https://www.smartcup.online/BrandedGames/HangMan/HangManGame.html. The word you have to guess is "bag" Thank you for the attention.