获取浏览器里面的本地缓存
localStorage就是我们的浏览器缓存在哪都可以用
下面代码是获取打印到我们的页面上
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<div><input type="button" value="修改">
</div><script>let div=document.querySelector("div");let s=" ";for(let i=0,len=localStorage.length;i<localStorage.length;i++){let k=localStorage.key(i);let v=localStorage.getItem(k);s+=k+":"+v+"</br>";}div.innerHTML=s;window.addEventListener("storage",(event)=>{console.log(event.key);console.log(event.oldValue);console.log(event.newValue);console.log(event.url);})</script>
</body>
</html>