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

Feature Request: http header HX-Redirect with value back #2548

Open
rdehuyss opened this issue May 15, 2024 · 2 comments
Open

Feature Request: http header HX-Redirect with value back #2548

rdehuyss opened this issue May 15, 2024 · 2 comments

Comments

@rdehuyss
Copy link

I would like to propose a feature related to the http header HX-Redirect: would it be possible to send back(-x) instead of an url?

Use case:

  • I have a popup for an entity which has a unique url that can be triggered from different pages (so different referer urls)
  • this form has a delete button allowing to delete this entity
  • ideally, the user would go back after deleting the entity
@JanRomero
Copy link

Personally I would prefer a more explicit approach to header magic, such as:

hx-on::after-request="if (event.detail.successful) history.back()"

If you’re bent on keeping the logic server-side, you might send <script>history.back();</script>, but client-side seems preferable to me.

@richardvanbergen
Copy link

@JanRomero I'm not sure I agree with the framing that headers are "Magic" I mean HTTP verbs are at the core of HTMX and they have support for these hearers. Plus it seems to work with HX-Redirect.

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

3 participants