You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Maik Schindler (JIRA)" <ji...@apache.org> on 2016/02/04 10:06:39 UTC

[jira] [Created] (CB-10529) localstorage not persistent on device

Maik Schindler created CB-10529:
-----------------------------------

             Summary: localstorage not persistent on device
                 Key: CB-10529
                 URL: https://issues.apache.org/jira/browse/CB-10529
             Project: Apache Cordova
          Issue Type: Bug
    Affects Versions: 6.0.0
            Reporter: Maik Schindler


I write a value into the localstorage.
After restarting the app getItem will return null.

<code>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8" />

    <!--
        Passen Sie die Inhaltssicherheitsrichtlinie im META-Tag unten nach Bedarf an. Fügen Sie "default-src" die Option "unsafe-inline" hinzu, um Inline-JavaScript zu aktivieren.
        Details finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=617521".

    <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
        -->
    <meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; media-src *">
    <title>Test</title>

    <!-- MediaTest-Verweise -->
    <link href="css/index.css" rel="stylesheet" />

    <!-- Cordova-Verweis, wird Ihrer App beim Erstellen hinzugefügt. -->
    <script src="cordova.js"></script>
    <script src="scripts/platformOverrides.js"></script>

    <script src="scripts/index.js"></script>
    
    <script src="scripts/jquery-2.1.4.min.js"></script>
    <script src="scripts/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
    <p>Hello, App is ready!</p>
    <button id="Write">Write</button>
    <button id="Read">Read</button>
    <script>
        $(document).ready(function () {

            

            $('#Write').on("tap", function () {
                window.localStorage.setItem("Test", "Value");
                console.log("Test Value written");

            });


            $('#Read').on("tap", function () {
                console.log("Read Test "+window.localStorage.getItem("Test"));
            });

        });

    </script>
</body>
</html>
</code>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org