سؤال

this code works in Firefox and Safari, but in Chrome Version 33.0.1750.149 the localStorage is always empty after restart. (In DevTools as well as accessed through console)

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript">
        function saveStuff() {
            localStorage.setItem('localKey', 'localValue');
        }
    </script>
</head>
<body onload="localStorage">
<button type="button" onclick="saveStuff()">Save</button>
</body>
</html>

What am I doing wrong?

هل كانت مفيدة؟

المحلول

The problem was solved by disabling the option "Block third party cookies".

نصائح أخرى

my same problem solved by disabling the option "Clear cookies and site data when you quit Chrome" in security settings of chrome

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top