tips and tricks for movable type
open links in new window
March 24, 2002
Javascript provided by Ben Trott to open all links in a new window.
I need to add this to my comments popup window so URLs are browsable from within there!! (Or maybe it would just be easier to make the popup window resizable?)
This goes between your HEAD tags:
<script language="javascript">
function reTargetLinks () {
for (var i=0; i<=(document.links.length-1); i++)
document.links[i].target = 'new';
}
</script>
function reTargetLinks () {
for (var i=0; i<=(document.links.length-1); i++)
document.links[i].target = 'new';
}
</script>
And this goes in your BODY tag:
<body onload="reTargetLinks()">
Comments
I love this BUT when I insatlled it every link pop up in a new window. Is there a way to make some not link archives and the extened entries.
Some more info about this script is at randomwalks ;)
Thanks! This solved a rather convoluted problem.
You should changed the target from being 'new' to '_blank'. _blank is the correct window name.
function reTargetLinks () {
for (var i=0; i