Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Make links open in new window?

This discussion is related to the CLEditor jQuery WYSIWYG addon.

Is there a way to modify the plugin so links inserted with CLEditor open in a new window?

Comments

  • TamaTama United Kingdom ✭✭✭

    I added some javascript to the bottom of my default.master.tpl, to ensure that all links even if they are added in source mode open in a new window.

    Maybe a bit of a ghetto fix but it's easy to install

    http://pastebin.com/GKPPQ3HP

    There was an error rendering this rich post.

    Celestehgtonight
  • @Tama Looks great, thank you!

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    @Celeste If you don't want all the links to open in a new page but just the attachments you can also use this small code also in between {literal } tags for tpl . If you copy this remove the spaces I added between the < > so they could show here.

    < script type="text/javascript" > $(document).ready(function() {
       $(".Attachment a").attr("target", '_blank');
       });
    < /script >
    
    
    hgtonight
  • @vrijvlinder Is an inserted link considered an attachment?

  • @hgtonight Thank you!

  • Actually, @hgtonight — that has a flaw, which is that it seems to also affect links like usernames and date permalinks. I just want it to work if someone inserts a link to another website in their discussion post/comment. How does CLEditor form the code that makes the links? It seems like there should be some way to edit that as opposed to the overall theme.

  • @hgtonight Perfect! Thanks again =)

  • Hello guys,
    I'm trying this solution without any luck.

    Where is this code supposed to be placed on default.master.tpl?
    It's making my page crash :(

  • NabUserNabUser New
    edited November 2014

    NVM found the solution. we need to add it as follows:

    {literal}  
    <script type="text/javascript">
          $(document).ready(function() {
      $('.MessageList .Message a').attr('target', '_blank');
    });
    </script>
    {/literal}
    

    Mind the extra space after < and before > . These should be removed

    R_Jperegrine
  • @NabUser said:
    Hello guys,
    I'm trying this solution without any luck.

    Where is this code supposed to be placed on default.master.tpl?
    It's making my page crash :(

    post what you did!

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • It's up there !

Sign In or Register to comment.