The htmx History Owl!

Created: 2022-01-18

hx-history-elt

This child page demonstrates the hx-history-elt attribute in htmx.

Click here to go back to the mother document.

Here’s the behavior you’ll see on this page:

  • There are two Forest Blog reading areas.

  • You can independently page through the blog in either area.

  • The top one is the history element, only it will reflect browser backward/forward actions.

  • Both of them are added to the history because they are boosted links.

  • So you’ll have a history entry for every click in either area.

  • But the bottom one doesn’t go forward/backward.

  • This makes the history appear "broken" if you alternated between the two areas.

History element:
NOT the history element:

Other interesting things about this page

history owl is tired
  • If you page through the "Forest Blog" below, your browser address bar will reflect the page.

  • The browser forward/back buttons will navigate the forest blog pages.

  • If you refresh the browser, you’ll be taken directly to the forest blog API result content of whatevery page number you’re looking at…​which is unformatted HTML.

  • The forest blog content is randomly generated, but paging forward and backward within this page will show cached content - this is the htmx history mechanism in action, not the browser’s cache.