This is HTML & Javascript.
I have a variable that contains a div element of the page1. All I need is pass this variable to a page 2 (which gonna be embedded with iframe in page1, inside the div of that variable).
//So: (Javascript in page 1)
//This creates the div and gives it an id.
var MainDiv = document.getElementById('div');
MainDiv.id = "It's me!";
//And now, with JSON, "localStorage" it:
localStorage.setItem("MD", JSON.stringify(MainDiv));
//And now, in page2 we retrieve it, but the object is not the same
var Page1Div = localStorage.getItem("MD");
alert(Page1Div .id);
//This will output "undefined";
I make a try with jStorage too, (using):
$.jStorage.set("MD", MainDiv);
var Page1Div = $.jStorage.get("MD");
But still the same output of "undefied".
What I haven't understand, why this isn't capable to store the div object variable in localStorage?.