firefox 67.0.3 (android)
firefox 68.0b14 (android)
(opera 52.4.2517.140781 (android))
Local Storage is not stored value.
Wrote a simple example.
It shows the current valu… (читать ещё)
firefox 67.0.3 (android)
firefox 68.0b14 (android)
(opera 52.4.2517.140781 (android))
Local Storage is not stored value.
Wrote a simple example.
It shows the current value of 'LS'.
Went clicked in the monitor.
The value of 'LS' has changed .
Closed the browser - opened and the value 'LS' is not preserved.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="index, follow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="copyright" content="">
<meta name="keywords" content="">
<meta name="description" content="localstprage">
<title>localstoragetest</title>
<style>
*{margin: 0px; padding: 0px;}
#iphone, #android{font-size: 28px;}
#del{width: 50px; height: 50px; float: right; background-color: green;}
</style>
<script>
window.addEventListener('click', function(e) // срабатывает при загрузке страницы БЕЗ CSS
{
"use strict";
var id = e.target.id;
var iphone = document.getElementById("iphone");
var cur_LS = localStorage.getItem("test");
if (cur_LS === "123") {localStorage.setItem("test","ABC");}
if (cur_LS === "ABC") {localStorage.setItem("test","123");}
if (cur_LS === null) {localStorage.setItem("test","ABC");}
if (id === "del") {localStorage.removeItem("test");}
cur_LS = localStorage.getItem("test");
iphone.textContent = "set_new = "+cur_LS;
});
window.addEventListener('DOMContentLoaded', function() // срабатывает при загрузке страницы БЕЗ CSS
{
"use strict";
var android = document.getElementById("android");
var cur_LS = localStorage.getItem("test");
android.textContent = "read "+cur_LS;
});
</script>
read
new
DEL_LS