Sorry for the long title, but i wanted a precise title. I am wondering if there is a script out there, or maybe simple settings that can be used to force links that start with the url of the originating domain to open in the same window/Tab. If am not clear enough, let me know with a question.

I would recommend a javascript solution so it is less hands on.

<html>
<head>
<title>none</title>
<script language="javascript" type="text/javascript">
function alterLinks()
{
	links = document.getElementsByTagName("a");
	for(i = 0; i < links.length; i++)
	{
		if(links[i].href.indexOf("localhost") != -1)
		{
			links[i].target = "";
		}
		else
		{
			links[i].target = "_blank";
		}
	}
}
</script>
</head>
<body onLoad="alterLinks();">
<a href="http://localhost/">home</a><br />
<a target="_blank" href="http://localhost/">home</a><br />
<a target="_blank" href="http://localhost/">home</a><br />
<a target="_blank" href="http://localhost/">home</a><br />
<a target="_blank" href="http://www.google.com/">home</a><br />
<a target="_blank" href="http://www.daniweb.com/">home</a>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.