You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to create an application that also works with static .html pages loaded over file:// urls where I presume htmx doesn't work because XMLHttpRequest doesn't work for file:// urls for security reasons.
Is there a best practice for this? I'm a complete htmx newbie.
I'm thinking something like this:
<divid="htmx-container"><ahref="full-clicked.html" hx-get="clicked.html" hx-target="#content">
Show contents
</a><divid="content">
original contents to be replaced
</div></div><script>if(newURL(document.location).protocol=="file:"){document.getElementById("htmx-container").setAttribute('hx-disable',"true")}</script>
And then generate both full-clicked.html that replaces the entire page (for the file:// case) and clicked.html for the htmx case statically.
I have two questions:
Is something like what I've outlined above reasonable, or is there a better approach?
How can I disable htmx on file:// pages? Are there any parts of htmx that work on file:// pages? How do I most elegantly disable the rest? The above hx-disable approach looks like it works...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I'd like to create an application that also works with static .html pages loaded over file:// urls where I presume htmx doesn't work because XMLHttpRequest doesn't work for file:// urls for security reasons.
Is there a best practice for this? I'm a complete htmx newbie.
I'm thinking something like this:
And then generate both
full-clicked.html
that replaces the entire page (for the file:// case) andclicked.html
for the htmx case statically.I have two questions:
hx-disable
approach looks like it works...Beta Was this translation helpful? Give feedback.
All reactions