hx-history

将当前文档中任何元素或 htmx 加载到当前文档中的任何 html 片段上的 hx-history 属性设置为 false,以防止在 htmx 拍摄页面状态快照时将敏感数据保存到 localStorage 缓存中。

¥Set the hx-history attribute to false on any element in the current document, or any html fragment loaded into the current document by htmx, to prevent sensitive data being saved to the localStorage cache when htmx takes a snapshot of the page state.

历史导航将按预期工作,但在恢复时,将从服务器而不是历史缓存请求 URL。

¥History navigation will work as expected, but on restoration the URL will be requested from the server instead of the history cache.

这是一个例子:

¥Here is an example:

<html>
<body>
<div hx-history="false">
 ...
</div>
</body>
</html>

注释

¥Notes