remote-local-storage/wrap.html

47 lines
1.0 KiB
HTML
Raw Permalink Normal View History

2024-08-30 18:16:40 -04:00
<!doctype html>
<html>
<head>
<link rel="icon" href="data:;base64,iVBORw0KGgo=" />
<script>
(async () => {
const resp = await fetch("loadLS");
const lsItems = JSON.parse(await resp.text());
for (const key in lsItems) {
localStorage.setItem(key, lsItems[key])
}
console.log("Loaded local storage");
})();
function postLocalStorage() {
(async () => {
const resp = await fetch("saveLS", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(localStorage),
});
console.log(await resp.text());
})();
}
setInterval(postLocalStorage, 10 * 60 * 1000) // 10 mins
</script>
<style>
body {
margin: 0;
}
iframe {
width: 100vw;
height: 100vh;
border: none;
}
</style>
</head>
<body>
<iframe src="/"></iframe>
</body>
</html>