I am using Firefox 83.0 64-bit on a Windows laptop.
I was hoping to prototype some website code locally (using the Windows directories) prior to testing with a proper web… (funda kabanzi)
I am using Firefox 83.0 64-bit on a Windows laptop.
I was hoping to prototype some website code locally (using the Windows directories) prior to testing with a proper website.
I have been unable to get sessionStorage (or localStorage) to pass variables to another page unless they're in the same Windows directory. For instance, if I create 2 very simple and cut-down test files: Test1.html and Test2.html, that contain the following JavaScript:
Test1.html
window.sessionStorage.setItem ("html", element.innerHTML);
alert ("posting " + window.sessionStorage.getItem ("html"));
window.open ("Test2.html", "_self");
Test2.html
var html=window.sessionStorage.getItem ("html");
alert ("received " + html);
then it works if the two files are in the same directory. But if Test2 is in a subdirectory, and I change the open call to:
window.open (".\\subdir\\Test2.html", "_self");
then it receives null instead of the HTML that Test1 is sending. I am guessing that there is some code that is treating the change of directory as a cross-origin issue, even though they're under the same root directory.
I appreciate that the specification may be a bit vague in this non-Web situation, but Chrome does what I would expect. I thought someone might want to take a look to check if this was an oversight or deliberate.