BoldSource

Use JQuery to open external links in a new window

I spent some time searching the web for a solution and found a lot of out dated ones or ones that just weren’t what I wanted. Here is an easy to implement snippet for anyone interested:

  $("a[href^=http]").each(function(){
    if(this.href.indexOf(location.hostname) == -1) {
      $(this).attr('target', '_blank');
    }
  });

This is an updated version of the code found here: http://www.drupalcoder.com/story/80-automatically-open-all-external-links-in-a-new-window-using-jquery. Notice the @ symbol which is now no longer supported in Jquery 1.3.x.




Gotta love late night ie6 debugging


Listening To: Virus by Deltron 3030

Great late night programming music.


Drupal Week Module Issues

Just posted up a few patches for the Week module. It did exactly what I needed it to, except there were a few things that needed some tweaking.

http://drupal.org/node/597522

http://drupal.org/node/597472


Code Font — I <3 Monaco

http://en.wikipedia.org/wiki/Monaco_%28typeface%29



This is an awesome presentation. It really helps give some perspective on the relationship between design and code when working in on an MVC app.






26
To Tumblr, Love Metalab