Redirect asset in new window using target instead of JS
D
David Gafford
We are using a redirect asset to provide a link to a survey from a component on our site. When the New window toggle is used it invokes javascript to open in new window without the browser address bar which gets blocked by some web browsers.
As the target attribute of the link element is included in the html spec could a non-js approach to this be used or offered instead?
E.g. the New window setting could offer:
New window (toggle)
Use javascript (toggle)
Options
Window width/height...
Without toggling use javascript target attribute will be set to _blank
Iain Simmons
I might be misunderstanding, but I think you'd need to set the target attribute on the link that is pointing to the Redirect Page asset, not within the Redirect Page asset details/settings itself.
D
David Gafford
Iain Simmons you could do it that way however this means if you'd potentially need to change the html in a paint layout or include everytime you need to change how a link behaves for a particular usage. The redirect page asset type has a section on it's details screen referring to "New window" behaviour, it is this that I'm suggesting could use a more accessbile non-js based approach to prevent browsers blocking the popup. Documentation reference here https://docs.squiz.net/matrix/version/latest/features/page-assets/redirect-page.html#new-window