Forum

Thread tagged as: Question

link target

hi,

writing text in the textarea (textile), clicking on the link-icon - is it possible to open links in a new window ? how would i do this ?

thanks, best regards, katja

Katja Schwarz

Katja Schwarz 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

That's not possible to do with Textile directly. You could add a class to the link and then use JavaScript to open links with that class in a new window.

Simon Clay

Simon Clay 127 points

You can do this with the Redactor editor. I think it's the best of the available editors.

i'll try Redactor, thanks !

If it helps, this is how we do it. A small piece of javascript inside <head> on a page where we want any links to open in a new window because they are displaying an external site. It works for all links that inside a div with the id of 'news' on the page ...

<script type="text/javascript">
$(document).ready(function(){
  $('#news a').click(function(){
    window.open(this.href);
    return false;
  });
});
</script>