Open view links in the current browser tab #10220
-
DescriptionIt's currently impossible to open the 'View' link on entry pages in the current browser tab. Currently, the 'View' link is a
Possible solutionsSome of these issues can be worked around with additional code. The middle mouse button can be handled in JavaScript to open the link in a new tab. The accessibility can be improved by adding a visually hidden message to indicate the button will open a new tab. But I'd argue the best fix would be to change the Another option would be a general config setting or user preference to control whether view links open in a new tab or the current tab. This option could be handled in JavaScript. Though this would only solve the UX problem partially, and you still couldn't choose to open links in the current or a new tab every time. Additional info
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
This is a tricky one… the preview links can’t really be pre-generated (or generated on However I just came up with a semi-clever solution: we are now pre-generating the random 32-character token string during page load, so now the JS knows what the final tokenized URL will be once the token has been “activated” (saved in the back-end). Thanks to that, the View button can now be an Craft 3.7.25 is out now with those changes! |
Beta Was this translation helpful? Give feedback.
This is a tricky one… the preview links can’t really be pre-generated (or generated on
click
) because they are tokenized, and the token needs to be saved on the back-end in order to work, and it’s probably not a good idea to pre-generate a new preview token every time an Edit Entry page is loaded.However I just came up with a semi-clever solution: we are now pre-generating the random 32-character token string during page load, so now the JS knows what the final tokenized URL will be once the token has been “activated” (saved in the back-end). Thanks to that, the View button can now be an
<a>
tag that initially links to thepreview/create-token
controller, passing the pre-generated token …