Save 36% for Black Friday! Learn more

New Discussion

Notifications

You’re not receiving notifications from this thread.

Hotwire prevents link_to from going to a different website

1
General

I recently added Hotwire to my rails app to update modals but this broke a link_to I had that redirected users to stripe. I looked online for ways to work around it but since Hotwire is relatively new, I couldn't find it. Does anyone have any recommendations on getting link_to to work with turbo stream?

Use target="_top" as shown in https://github.com/hotwired/turbo-rails/blob/main/app/helpers/turbo/frames_helper.rb:
<%= turbo_frame_tag "tray", src: tray_path(tray), target: "_top" %>
The issue is that Turbo Frames hijacks links as described quite well here: https://blog.cloud66.com/taking-rails-to-the-next-level-with-hotwire/

Join the discussion
Create an account Log in