Kudos for at least caring. :-) I have one client who is so worried about people leaving his "home page" that in spite of my vigorous protests, every link on his site is a new window. He also wants them "as big as possible" and insists on _blank. But refuses to use Javascript. It makes my eyes bleed.
If you have a limited set of links, use it as below with the array. This will leave your (X)HTML clean and lean, as shown. Otherwise, just do
<a id="link1" href="link.html" target="_blank" onclick="
return newWin(this.href);">link</a>
The return is important, it's what stops it from navigating to the link in href.
In the head, or better yet, as external JS,
<script type="text/javascript">
window.onload=function() { attachBehaviors(); };
//
function attachBehaviors() {
// ID's of the links
var newWins = Array (
'link1',
'link2',
'link3'
// etc
);
for (j=0;j<newWins.length;j++) {
if (document.getElementById(newWins[j])) {
document.getElementById(newWins[j]).onclick=function() { return newWin(this.href); }
}
}
}
//
function newWin(url) {
// adjust width and height to taste
var w = 600;
var h = 800;
if ((screen.height) && (h > screen.height)) { h = screen.height-25; }
var day = new Date();
var id=day.getTime();
var params = 'toolbar,location,status,menubar,scrollbars,resizable,';
params += 'width='+w+',height='+h+',top=0,left=0';
open(url,id,params);
return false;
}
</script>
In the body, the only thing important here are the ID's,
<ul>
<li><a id="link1" href="https://www.google.com" target="_blank">Link 1</a></li>
<li><a id="link2" href="https://www.yahoo.com" target="_blank">Link 2</a></li>
<li><a id="link3" href="https://www.webmasterworld.com" target="_blank">Link 3</a></li>
</ul>
I used HTTPS so the software doesn't bury the URL's in that link widget thingy generated by the last revision of this board . . .