Published in: JavaScript
Javascript Open Page in New Window Using rel="blank." Put this function in the . To create a link that open in a new page use
<!-- 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.getAttribute("rel") == "blank") { anchor.target = "_blank"; } } } window.onload = externalLinks; //-->
Comments
Subscribe to comments
You need to login to post a comment.

Why use this in stead of the target attribute?