From this page you can share A More Intelligent Open in New Window Script to a social bookmarking site or email a link to the page.
Social WebE-mail
Enter multiple addresses on separate lines or separate them with commas.
A More Intelligent Open in New Window Script
(Your Name) has forwarded a page to you from Ajaxonomy
(Your Name) thought you would like to see this page from the Ajaxonomy web site.

A More Intelligent Open in New Window Script


Recently, I needed to create a small JavaScript that would make links for documents and outside web sites open the links in a new window. However, any link from the web site that held the links needed to open in the same window. This was made a bit more complicated by the fact that the system that was holding the links (a third party web content management system) did not allow for the user to decide if they wanted the link to open in a new window when they created a new link.

Because I could edit the JavaScript that loaded when the page was loaded, the solution that I came up with was to call the below function in a function that was called onload. What this JavaScript does is go through all of the links on the page and any link that matches the criteria is changed to have a target of blank.

function AddTarget(){
	var TargetTag2 = document.getElementsByTagName("a");
	for(var a=0; a

Sometimes a simple JavaScript can save the day.