Skip to main content
Solved

Open in a new tab in Phrases

  • August 25, 2025
  • 3 replies
  • 30 views

jvdc
  • Helper ⭐️⭐️⭐️

Hey what's the trick to get to open a link in a new tab when modifying a Phrase?

I tried adding target="_blank" but it keeps getting sanitized...

Best answer by Kenneth R

Yep gotcha.  I do think your only bet here is to use a Third-Party Script.  Here is an example that just worked fine for me in our sandbox.  Big caveat here is that I’m not a developer so please do your own testing if you decide to take this kind of approach.  :)

<script>
(function () {
var HREF = "https://example.com/guide"; // exact URL
var timer = setInterval(function () {
var as = document.querySelectorAll('a[href="' + HREF + '"]');
if (as.length) {
as.forEach(function (a) {
a.target = "_blank";
a.rel = "noopener noreferrer";
});
clearInterval(timer);
}
}, 400);
})();
</script>

 

3 replies

Kenneth R
Forum|alt.badge.img+5
  • Expert ⭐️⭐️
  • August 26, 2025

Hey ​@jvdc - Yeah something like that will get stripped from phrases.  It’s really for security to prevent unsafe scripts from getting injected into the page.  Which phrase in particular is it that you’re trying to do this with? 

I do think it generally should be possible to ‘force’ the behaviour by adding some JS into your Third-Party Scripts, but it would be a little hacky.


jvdc
  • Author
  • Helper ⭐️⭐️⭐️
  • August 26, 2025

Ah, I see.

It's for the terms link on the user registration form. Our platform is private and therefore we can't link to the Terms page as users won't be able to access it. So we've created a public page on one of our sites to host those terms.

So I would like that link to open in a new window to prevent the users from leaving the registration form that they filled in...


Kenneth R
Forum|alt.badge.img+5
  • Expert ⭐️⭐️
  • Answer
  • August 26, 2025

Yep gotcha.  I do think your only bet here is to use a Third-Party Script.  Here is an example that just worked fine for me in our sandbox.  Big caveat here is that I’m not a developer so please do your own testing if you decide to take this kind of approach.  :)

<script>
(function () {
var HREF = "https://example.com/guide"; // exact URL
var timer = setInterval(function () {
var as = document.querySelectorAll('a[href="' + HREF + '"]');
if (as.length) {
as.forEach(function (a) {
a.target = "_blank";
a.rel = "noopener noreferrer";
});
clearInterval(timer);
}
}, 400);
})();
</script>