'Session Storage in IE 11
I'm having some difficulties with my current task. It happens that I'm building some HTML pages and I want to transfer data from one to another. I'm using "sessionStorage" for this, which works fine on Google Chrome, but not on Internet Explorer 11 or Edge.
When it's executed it's not recognized, and it says
...unable to get property 'setitem' of undefined or null reference
Edit: I share with you the code block where the error is thrown
var _pnome = document.getElementById("nome1").value;
var _pbday = document.getElementById("bday1").value;
var _page = document.getElementById("age1").value;
var _prof = document.getElementById("prof1");
var _prof_selected = _prof.options[_prof.selectedIndex].text;
sessionStorage.setItem("pname", _pnome); //The error is in this line
sessionStorage.setItem("pbday", _pbday);
sessionStorage.setItem("page", _page);
sessionStorage.setItem("pprof", _prof_selected);
Solution 1:[1]
How do you access the page? Local (file://) or Server (http://)?
I have created a sample using session storage, it works well on my side (using IE 11.116.18362.0 and Microsoft Edge 44.18362.1.0, running on the server). After researching, it seems that, if we access the page from locally, it will show this error. Please check it and access the web page from server.
Besides, if still not working, perhaps the issue is related to the browser setting, try to reset the browser setting: reset IE browser setting and rest Edge browser setting.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Zhi Lv |