> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# lynx: getSessionStorageItem() static method

APISummary
`lynx.getSessionStorageItem` 方法用于获取当前 WhiteBoard 中的缓存数据。共享该 WhiteBoard 的 LynxView 可以获取相同的数据。可以调用 [lynx.setSessionStorageItem](/next/zh/api/lynx-api/lynx/lynx-set-session-storage.md) 设置数据。

共享范围、原生配置和生命周期管理详见 [跨 LynxView 共享数据](/next/zh/guide/share-data-across-lynxviews.md)。

## 语法

```ts
lynx.getSessionStorageItem(key, (value) => {});
```

### 参数

#### key

缓存数据 key，通过该 key 来获取缓存数据以及监听数据变化。

#### callback

获取缓存数据的回调函数，参数为缓存的数据对象。

### 返回值

无（`undefined`）。

## 兼容性

**Compatibility Table**

**Query:** `lynx-api.lynx.getSessionStorageItem`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-api/lynx/getSessionStorageItem.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| getSessionStorageItem | Yes (2.9) | Yes (3.8) | Yes (2.9) | Yes (3.5) | Yes (3.5) | No |

**`getSessionStorageItem`**

The `lynx.getSessionStorageItem` method is used to retrieve data shared across multiple LynxViews. This enables data sharing between multiple pages via `SessionStorage`. You can call [lynx.setSessionStorageItem](./lynx-set-session-storage.mdx) to set the cached data.

- **Web — Not supported:** The Web runtime does not implement the native session-storage bridge.

