lundi 26 décembre 2016

Cordova - localStorage in iframe gets cleared on application restart

The index.html file looks like this currently:

<!DOCTYPE html><html><head style="overflow: hidden; margin:0; padding:0;border:0;">
    <meta charset='UTF-8'/>

    <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'" />
</head>
    <body style="overflow: hidden; margin:0; padding:0; width:100vw; height:100vh;border:0;">
        <iframe src="http://domain.com" style="overflow: hidden; margin:0; padding:0; width:100vw; height:100vh;border:0;"></iframe>
    </body>

    <script type=text/javascript>
        alert(window.localStorage.getItem("aaa"));
        window.localStorage.setItem("aaa", "111")
    </script>
</html>

The alert in the script does get persisted on application restart.

However localStorage the iframe uses, gets cleared on application restart making the use of iframe not equal to the psuedo intention.




Aucun commentaire:

Enregistrer un commentaire