Streaming live at 10am (PST)

Open Rich Text Link In New Window


#1

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


Linking to Collections Pages from Dropdown menu
Opening links in a new tab created in CMS Rich Text
#2

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 external links only, like [http://www.google.com]:

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

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


#3

@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"


#4

"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.


#5

Great thanks. I'll give this a try.


#6

Isn't the "link class" created by the rich text editor just whatever was established by the "all links" class?


#7

@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


#8

What is your Rich Text class name?


#9

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


#10

In your case it should be like this:

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

Opening links in a new tab created in CMS Rich Text
#11

Yeah!!! Thanks mucho :smile:


#12

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


#13

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