The following code
$(document).ready(function(){
sessionStorage.test = false;
alert( sessionStorage.test );
if ( sessionStorage.test ) {
alert("I dont care about your conditions!");
}
});
produces the following popups:
false
I dont care about your conditions!
even though sessionStorage.test
is clearly set to false. Why is that the case? According to this answer https://stackoverflow.com/a/17986241/2311074, this should work. What am I doing wrong? I am using XAMPP - does it maybe have problems with sessionStorage? Here is the complete code of my test file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script >
$(document).ready(function(){
sessionStorage.test = false;
if ( sessionStorage.test ) {
alert("I dont care about your conditions!");
}
});
</script>
</head>
<body>
<!-- page content -->
</body>
</html>