[Auto-Execute] Open external links in new window

Finished Scripts and Buttons ready for download can be found here.

Moderators: Support Staff², Support Staff, AvantGuard, Developer

Post Reply
addonsfan
Avantic Elite
Avantic Elite
Posts: 1940
Joined: Sun Aug 05, 2007 11:56 am
Windows Version: Windows 7
Avant Version: N/A
IE Version: N/A
Location: California, USA
Contact:

[Auto-Execute] Open external links in new window

Post by addonsfan » Thu Oct 04, 2007 1:58 am

right click > customize > addons > add
title: anything
type: auto-execute script
content:

Code: Select all

if (location.hostname == "forum.avantbrowser.com") window.onload = function() {
	var anchorTags = document.getElementsByTagName("a");
	for (var i = 0; i < anchorTags.length ; i++) {
		//alert (anchorTags[i].hostname + " != " + location.hostname);
		if (anchorTags[i].hostname != location.hostname) {
			anchorTags[i].target = "_blank";
		}
	}
}
to get this to work with any site opening external links, remove:
if (location.hostname == "forum.avantbrowser.com")

bigC
AvantGuard
AvantGuard
Posts: 7244
Joined: Thu Jan 30, 2003 10:40 pm
Windows Version: 10
Avant Version: 2016 Build 1
Default engine: Firefox
IE Version: 11
Skin: Crystal
Location: New York

Re: [Auto-Execute] Open external links in new window

Post by bigC » Thu Oct 04, 2007 6:55 pm

Why not export this to an .aba file and upload it to the forum? Its easier/more convenient for people to install...

addonsfan
Avantic Elite
Avantic Elite
Posts: 1940
Joined: Sun Aug 05, 2007 11:56 am
Windows Version: Windows 7
Avant Version: N/A
IE Version: N/A
Location: California, USA
Contact:

Re: [Auto-Execute] Open external links in new window

Post by addonsfan » Thu Oct 04, 2007 7:51 pm

Install:
[url]aba://forum.avantbrowser.com/download.php?id=204[/url]
Attachments
extern_links_window.aba
(623 Bytes) Downloaded 484 times

Post Reply