Some clients just absolutely demand that links to other sites should open a new window, in order to provide external links, while also keeping their own visitors on their site. The method typically relied on to do this is to add a target attribute to each individual link. That method has two flaws:
Back to the point. The code here simply enumerates every anchor on the page and adds target="_blank" to each link that goes to a domain other than the active one.
While you could add this script to the specific pages you want to affect, it's easiest to simply add a script tag to a script with the following contents:
/* Shawn K. Hall http://12PointDesign.com/ Copyright (c) 2004,2010 */ function blanky(){ // remove trigger try{ window.clearInterval( blankyt ); }catch(e){}; // set external links to new window var c = document.links; var d = document.domain; for(var a=0; a<c.length; a++){ if(c[a].href.search(d) == -1) c[a].target = "_blank"; } } var blankyt= window.setInterval( "blanky()", 3500 );
If you are using a script tag, you'd use something like this:
<script src="/scripts/blank.js" type="text/javascript" ></script>