Hi,

i want a very easy thing. All links that the URL-Filter create should open in a new window. When my users write comments and post an url and someone click on it, he/she leaves my site and go to the linked page. I want that the links opens in a new window. I think it is a must have feature, all of my users asked me if i can configure this, but i can't.

Is it possible to get an option in the url filter settings how the links should handled?

Thanks and greetings

strauch

p.s. i can't find any post on drupal.org that gives me a solution. I'm wondering that no one have the same problem.

Comments

dawehner’s picture

you have to define a filter with a module, see hook_filter and especially filter_filter

there you see the URL Filter. Just copy the code of this filter $delta =2

This function returns the html, I changed the function for you

<?php
function _filter_url_parse_partial_links($match) {
  $match[2] = decode_entities($match[2]);
  $caption = check_plain(_filter_url_trim($match[2]));
  $match[2] = check_plain($match[2]);
  return $match[1] .'<a href="http://'. $match[2] .'" title="'. $match[2] .'" target="_blank" >'. $caption .'</a>'. $match[3];
}
?>

if you really want to use it you should read the last paragraph of http://de.selfhtml.org/html/verweise/definieren.htm#zielfenster

sun’s picture

Status: Active » Closed (won't fix)

Drupal core won't support this option.