Open Rich Text Link In New Window

Is there an option for this somewhere or do we need to approach it differently?

Hi @jdesign,
I think for now there is no “easy” way to do this.
But I found out that there is link attribute which control this - “target”.
Also I found the code example which force links to open in a new window:

For all type of links (internal and external):

<script>
jQuery(document).ready(function() {
    jQuery(".wiki-content a").attr("target", "_blank");
});
</script>

Try to use it in Custom Code area with your links classes. Hope it helps.

Cheers,
Anna

2 Likes

@sabanna
I dropped this code into the custom code section on my website, but it has not made a difference. I’m trying to get links created in the CMS by my client to open a new tab.

Can you clarify what you mean by “try to use it in Custom Code area with your links classes”

“Custom Code area” I meant this part:

And class of your link, which you want to be opened, not .external-link or .wiki-content, but some class that you use.

Great thanks. I’ll give this a try.

1 Like

Isn’t the “link class” created by the rich text editor just whatever was established by the “all links” class?

@sabanna I’ve moved the script to the correct location, but since (to my knowledge) I cannot specify the class of the link that is created in the Rich Text I don’t know what to use

What is your Rich Text class name?

On that particular page it is called News Paragraph. See attached screenshot

This is where the link lives in the CMS

I tried using the rich text class name, but it still isn’t working

Here is my share link:
https://preview.webflow.com/preview/faberlawgroup?preview=eceb23a93d53650dab1ccd06fa565a4c

In your case it should be like this:

  <script>
            jQuery(document).ready(function() {
            jQuery(".news-paragraph a").attr("target", "_blank");
          });
    </script>
5 Likes

Yeah!!! Thanks mucho :slight_smile:

3 Likes

Awesome! :v: We did it! :smiley:

3 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.