Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make the base of URL constructor configurable? #3212

Open
hesxenon opened this issue Feb 25, 2025 · 2 comments
Open

make the base of URL constructor configurable? #3212

hesxenon opened this issue Feb 25, 2025 · 2 comments

Comments

@hesxenon
Copy link

I have a rather niche use case (and will probably deploy a fork for now) where I'm trying to use HTMX out of an iframe with [href=about:srcdoc]. So when HTMX tries to construct any URL at all it's expanded to new URL("the path", "about:srcdoc") which obviously isn't a valid url.

Would it be possible to add a config option to specify the base parameter?

Like

urlBase?: undefined | string | "root"

where "root" would have the special meaning of using the root windows url.

@Telroshan
Copy link
Collaborator

Hey, as it's a niche usecase, I would recommend either:

  • Adding a htmx:configRequest event listener in your JS to modify the request's URL through event.detail.path (just realized that this event's documentation doesn't mention path though... But it's here!)
  • Creating a custom extension to handle that (that would use the same mechanism as described in my first point, this would simply allow you to configure it per-element with for example the said URL prefix in an attribute value)

Hope this helps!

@hesxenon
Copy link
Author

hesxenon commented Feb 27, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants