---
title: "Discussion on \"監聽 localStorage 事件：如何在同一頁面內偵測變更\" | Hashnode"
description: "Discussion on \"監聽 localStorage 事件：如何在同一頁面內偵測變更\". 瞭解如何在同一個頁面內監聽 localStorage 變更，透過覆寫 setItem、getItem、removeItem 等方法，使用 CustomEvent 觸發監聽，確保數據變動即時回應。"
url: "https://hashnode.com/posts/localstorage-event/67c5989e2e4f012d32eb1d2d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [監聽 localStorage 事件：如何在同一頁面內偵測變更](https://letswrite.hashnode.dev/localstorage-event?utm_source=hashnode&utm_medium=feed)

瞭解如何在同一個頁面內監聽 localStorage 變更，透過覆寫 setItem、getItem、removeItem 等方法，使用 CustomEvent 觸發監聽，確保數據變動即時回應。

Mar 3, 2025 · 1 min read · letswrite.hashnode.dev  
Read the article

-   [#localstorage](https://hashnode.com/tag/localstorage)
-   [#events](https://hashnode.com/tag/events)
-   [#listener](https://hashnode.com/tag/listener)

## Written by

[Let's Write](https://hashnode.com/@letswrite)

@letswrite · Taipei, Taiwan

  
[View profile](https://hashnode.com/@letswrite)

前端工程師 August 的學習筆記 — solving problems, in simple ways.

前端工程師 Augustus 的學習筆記 — solving problems, in simple ways.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
