sessionStorage is gone when browser is refreshed - Javascript
问题 I am trying to keep some data in sessionStorage, but if I refresh the page or leave from a link then come back, the sessionStorage no longer exists. I am new to sessionStorage, so sorry if this is an obvious fix. Essentially I store an array into the sessionStorage. $scope.addPlant = function(plant) { for (i = 0; i < $scope.userPlantList.length; i++) { if ($scope.userPlantList[i] === plant) { alert("You have already added this plant"); return; } } $scope.userPlantList.push($scope.currentPlant