I am working on Live Editor and use a HTML5 localstorage to store some important data,on my Main Page,
And I have an Iframe on my Main Page that is working on same domain which is used to show the result of editor, Here the problem is, whenever i write the JS code :
Like :
localStorage.clear();
To my editor and run it on my Iframe then it also clear my localStorage of Main Page.
How i Correct this problem ?
I am sending my code to iframe by using string,
iframe.contentWindow.document.head.appendChild(Script);
Script contains a script tag with the User Code and it will run only inside iframe!
But Why my localStorage.clear(); also clear Stored data of Main Page ?
Answer Will really appreciated !!