Enforcing _blank target on external links

When training new clients on how to edit their own websites in wordpress, I often mention the convention of ‘targeting blank’ when linking to another website. Adding the ‘target=”_blank”‘ tag to the link opens a new window when the user clicks the link, leaving the client website open in the background . Still, I know clients will forget this so I often add a little JavaScript code to make sure the links are always set to target blank:

Since I know all my wordpress sites include jQuery, I use that library to make the call as compact as possible:

CODE:
$(document).ready(function() {
$(“a[href^=’http:’]”).
not(“[href*=’CLIENTDOMAIN.COM’]”).
attr(‘target’,’_blank’);
});

what does it do? it finds all links that start with http:, then filters out (not) those links that go to the CLIENTDOMAIN.COM (their domain name), then it sets the ‘target’ attribute to ‘_blank’, linking all external links on the

Dreamweaver CS5 Beta

As a developer, I’ve learned to live with and love Adobe’s Dreamweaver CS4. Like many developers I’ve discovered my way around Dreamweaver’s little quirks and limitations. Still I anxiously await word of the next release.


I can only hope for a better FTP client and a revamped interface. What other features do you think Adobe should add to the next release of Dreamweaver?

 

Western Colorado Website Developer

Earthbound is based in Hotchkiss, Colorado one hour south of Grand Junction. We have been offering website development and website hosting services from Western Colroado since 1993! We provide world class service, with a small town touch.

If your current site is in need of a fresh look, a new feature or shopping cart, a better back end or cleaner navigation, Earthbound offers the professional service you need to create a web site that exceeds your expectations. Earthbound’s Complete Website Packages start at $250. Take a looks at some of the web sites developed by Earthbound to get an idea of what is possible.