-
Notifications
You must be signed in to change notification settings - Fork 684
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
Best way to support opening link in new tab #1768
Comments
What we ended up doing is creating a helper that wraps paths or URLs with the right attributes. Something like this:
Another more intrusive alternative that catches all links, is to override your path and URL helpers in your authenticated controllers, to include the params by default. But yeah, it would be nice to have a default helper for this in the gem. |
@flavio-b ok cool, so at least it's not just me missing something in the gem. |
Hi @oliwoodsuk, thank you for opening this issue! This is a great suggestion, the team is going to review it and look into it. |
Overview
I spent a day or so yesterday trying to figure out what the best way to support the scenario where a user command-clicks a link, so it opens in a new tab from within an embedded app.
We were previously on
v18.1.2
of this gem, and it seemed to be handled natively by the gem when theShopifyApp::EnsureAuthenticatedLinks
concern was included. Whilst inv21.8.0
of this gem, that concern adds support for deep links, it doesn't add support for opening pages in new tabs.However, it does work if a
shop
andhost
param is present on the request URL. If I'm remembering correctly from yesterday, it looked likeShopifyAPI::Auth
was responsible for part of this behaviour.So my question is, is there a way native to this gem that allows us to support opening links in new tabs?
We're currently solving this by dynamically adding the params to
<a>
href
s from stored.window
attributes via JS. This seems a bit hacky, maybe there's some kind of header support that could do the same thing? or maybe there's just a setting somewhere I've overlooked.Thanks for your help,
Oli
...bit of context
We're running a Rails 7.1 app with Turbo. Below are our controller setups.
The text was updated successfully, but these errors were encountered: