在 HTML 中,当窗口历史记录发生变化时执行脚本?

htmlweb developmentfront end technology更新于 2026/1/16 11:56:17

当窗口历史记录发生变化时,onpopstate 事件会触发。您可以像这样添加它 −

示例

<!DOCTYPE html>
<html>
   <body onpopstate = "onpopstateFunction()">

      <p>This is demo text</p>

   </body>
</html>

相关文章


有用资源