任何人都可以帮助我知道如何在HTML onload事件调用之前清除sessionStorage吗?我希望在我的html呈现之前清除存储在sessionStorage中的数据
答案 0 :(得分:1)
只需在entiry HTML:
之前运行sessionStorage.clear()
<html>
<head>
<script>
sessionStorage.clear();
</script>
</head>
<body>
<!-- HTML -->
</body>
</html>