Views block link defaults to target="_blank" using rewrite output My client is using d6 and views 3.  They want to be able to display a box containing a random static image with an internal link to display in the same browser tab or an external link that would display in a new tab.  I created a content type with a field to upload an image, a text field to include a url, and (for simplicity's sake) a text field to include the target (either _self or _blank).  Then I built a views block to display each image using the 'rewrite the output of this field' option on the image field.  The text for the rewrite looks something like this:

&lt;a href="[field_link_value]" [field_target_value]&gt;[field_image]&lt;/a&gt;.


The problem I'm having is even when field_target_value has target="_self" in it, views or something is ignoring it and the a tag is always showing up in firebug with target="_blank".  Another weird thing is that when I display the page source, the target doesn't appear at all.  When you click on the image, it does in fact bring the page up in a different tab as expected.

I've looked in the views code and did not see anything in there that seems to be the cause.  There is some custom code and theming on the site but I have not been able to find anything in there either.

Anyone have any clues why or thoughts on the strategy I am trying to use ??
Print the results from the views template.you can rewrite the views template for that specific field and check the link that whether its external or internal using the drupal function url_is_external and you can add the attribute target="_blank" to those views fields that are external urls.

Off topic suggestion : if you want all external links on your website should open in new tab then you can use the extlink module to open all external links in new tabs.


  External Links is a small module used to differentiate between
  internal and external links. Using jQuery, it will find all external
  links on a page and add an external icon  indicating it will take you
  offsite or a mail icon  for mailto: links.