В Index.html есть две кнопки для операций увеличения и уменьшения. На второй странице будут отображаться только данные, но мой код работает только на той же вкладке. Как сохранить данные после обновления страницы?
index.html
Код: Выделить всё
Live Users in Mall
Live Users in Mall
-
0
+
Код: Выделить всё
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
background-color: rgb(255, 255, 255);
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
text-align: center;
}
.card{
display: flex;
justify-content: center;
align-items: center;
height: 100%;
padding: 100px;
}
h2{
margin: 0 50px;
font-size: 50px;
}
button{
background-color: #ff9100;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 25px;
}
button:hover{
background-color: rgb(206, 206, 206);
color: #ff9100;
border-color: #000 ;
}
Код: Выделить всё
var data = 0;
document.getElementById("root").innerText = data;
function decrement() {
data = data-1;
if (data
Подробнее здесь: [url]https://stackoverflow.com/questions/66900517/is-there-any-method-to-pass-live-data-from-one-browser-tab-another-browser-tab-b[/url]
Мобильная версия