»
EnglishFrenchVietnamese

Print - Make link open in new tab/window - JavaScriptBank.com

Full version: jsB@nk » Link » Make link open in new tab/window
URL: https://www.javascriptbank.com/make-link-open-in-new-tab-window.html

Make link open in new tab/window © JavaScriptBank.comUse this simple JavaScript to make all links on your web pages open in new tab/window. Script is easy to setup, you should save them into a file to for using on many pages.

Full version: jsB@nk » Link » Make link open in new tab/window
URL: https://www.javascriptbank.com/make-link-open-in-new-tab-window.html



JavaScript
<script language=javascript>/*Kevin Yankhttp://www.sitepoint.com/authorcontact/48*/function externalLinks(){  if (!document.getElementsByTagName) return;  var anchors = document.getElementsByTagName("a");  for (var i=0; i<anchors.length; i++)  {      var anchor = anchors[i];      if(anchor.getAttribute("href"))anchor.target = "_blank";  }}window.onload = externalLinks;</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<a href="http://javascriptbank.com/">Home</a> | <a href="http://javascriptbank.com/4rum/">Forum</a> | <a href="http://javascriptbank.com/javascript/">JavaScript</a> | <a href="http://javascriptbank.com/service/">Services</a> | <a href="http://javascriptbank.com/javascript/submit-javascript-bank.html">Submit script</a> | <a href="http://javascriptbank.com/thietkeweb/javascriptmall/">Documentary</a> | <a href="http://javascriptbank.com/javascript/contact-javascript-bank.html">Contact us</a> | <a href="http://javascriptbank.com/javascript/aboutus-javascript-bank.html">About us</a><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->