is there an html code or a javascript code that makes all html pages open in a new window. Not something that I need to input for new pages. This is because i have an established website and i want all the windows open in a new window so that they don't leave the site. I figure putting something in the head tag would be faster an easier than manually changing each and every single link. I know people will ask about my internal links. My internal links are on a the side menu which is on a different file (I use ColdFusion). Thanks in advance
yea its in the html code i dont remember off the top of my head but while its <a href="http://www.Google.com target="_blank">Google</a> target blank opens a new window i think
Thanks but please read my original post...i know how to make a link open in a new window, i need a code that makes ALL links open in a new window on a particular page
I would recommend not doing this. It's annoying when windows keep opening. It will not keep your visitors...what it will do is bother them enough never to return.
Well, if you just insist on doing something silly, add this to your head area. <script type="text/css"> window.onload = function() { var links = document.getElementsByTagName("a"); for (var i = 0; i < links.length; i++) { links[i].onclick = function() { return !window.open(this.href); } } } </script> Code (markup): cheers, gary