Last updated 25 July 2008. Created on 15 November 2006.
Edited by aj045, tanepiper. Log in to edit this page.

Instead of using a link target which breaks XHTML 1.1 validity, you can create a popup link using jQuery.

To do this, you can use XPATH in jQuery functions

Now, in your template file (e.g. node.tpl.php) insert this code:

  $("a[@href^=http:]").click(function() {; 
    return false; 
});', 'inline' );

Now all external links on your site will pop up in a new window, but internal links will not be affected, provided they are not programmed with "http:" in front of them (most Drupal automatic links are not).

Looking for support? Visit the forums, or join #drupal-support in IRC.