blue-television-69795
04/19/2021, 4:23 PMproud-librarian-99598
04/19/2021, 6:50 PM<a href="..." to <a hx-get="..." target="html"> but that does not seem to work. The page looks like the CSS is not loaded anymore. Should this work or not?mysterious-toddler-20573
04/19/2021, 6:52 PMhx-target to be bodyproud-librarian-99598
04/19/2021, 6:52 PMmysterious-toddler-20573
04/19/2021, 6:53 PMhx-boost attribute to make links and forms act "ajaxy": https://htmx.org/attributes/hx-boost/mysterious-toddler-20573
04/19/2021, 6:55 PMproud-librarian-99598
04/19/2021, 6:55 PM<body>. Maybe because I also am using Alphine.js in the application.proud-librarian-99598
04/19/2021, 6:58 PM<div> "lower" in my HTML tree does make it work. But it breaks when using the back button of the browser.plain-kangaroo-26043
04/19/2021, 8:20 PMplain-kangaroo-26043
04/19/2021, 8:20 PMplain-kangaroo-26043
04/19/2021, 8:21 PMmysterious-toddler-20573
04/19/2021, 8:21 PMplain-kangaroo-26043
04/19/2021, 8:23 PMmysterious-toddler-20573
04/19/2021, 8:33 PMnarrow-chef-14221
04/19/2021, 10:54 PMdiv to a page that will render the current version of our app. I want to have that div automatically refreshed every X minutes via htmx. I'll use the information we're rendering there to display the user a message stating they have an old version with an invitation to click a link to refresh the page and load the latest version.
I have it pretty much working with hx-get="/version" hx-trigger="load delay:300s" hx-swap="outerHTML". But now I'd like to only make the request if that page is the currently active browser tab.
Any ideas?gorgeous-ghost-95789
04/19/2021, 10:55 PMgorgeous-ghost-95789
04/19/2021, 10:56 PMgorgeous-ghost-95789
04/19/2021, 10:57 PMgorgeous-ghost-95789
04/19/2021, 10:57 PMnarrow-chef-14221
04/19/2021, 11:01 PMvisibilityState property is quite standard these days and I could use that: https://caniuse.com/?search=visibilitystatenarrow-chef-14221
04/19/2021, 11:02 PMgorgeous-ghost-95789
04/19/2021, 11:02 PMfocus and blur events on the window.narrow-chef-14221
04/19/2021, 11:13 PMnarrow-chef-14221
04/19/2021, 11:14 PMnarrow-chef-14221
04/19/2021, 11:14 PMnarrow-chef-14221
04/19/2021, 11:52 PMhx-trigger="visibilitychange", or even something like "hx-trigger"="load delay:30s, visibilitychange", but it's not working. Not even throwing an error. It simply doesn't trigger. π¦narrow-chef-14221
04/19/2021, 11:54 PMvisibilitychange is an event triggered on the document by the browser anytime the document's visibility changes.narrow-chef-14221
04/20/2021, 12:25 AMvisibilitychange is an event triggered on the document and not in the div I'm putting the trigger on. I thought I could use the from:document event modifier but it fails because document is not a valid CSS selector. Is there any way to use from to listen on events being fired on document?mysterious-toddler-20573
04/20/2021, 12:26 AMdocument a valid css selector?mysterious-toddler-20573
04/20/2021, 12:27 AM