[Release] Make links open in a new tab

General questions about scripts and buttons should be asked here. Development scripts and buttons may also be posted for feedback.

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

Post Reply
Scrabble
Semi-Fan
Semi-Fan
Posts: 68
Joined: Sat Nov 18, 2006 10:36 pm
Windows Version: Windows
Avant Version:

[Release] Make links open in a new tab

Post by Scrabble » Thu Mar 15, 2007 8:27 pm

First, I want to say I know all you have to do is enable middle click option and use that to open links in a new tab. That works fine unless you don't have a middle button on your mouse or are using a laptop (like me).

You can make all links open in a new tab by going to Tools...Avant Browser Options...Add-Ons...Add-Ons. Then click add, give it a name, select an icon to identify it, make sure for "Type" that the 'Auto-Execute Script' is selected, then paste the text below into the 'Content' field:


var newwindow="_blank"

function hyperlinks(target){
if (target) where = newwindow;
else where = "_self";
for (var i=0; i<=(document.links.length-1); i++){
var linkobj=document.links.href
if ( linkobj.indexOf("javascript:") ==-1 && linkobj.indexOf("#") ==-1){
if (target && where!="_blank")
document.links.onclick=function(){
if (window.window2 && !window2.closed)
window2.location=this.href
else
window2=window.open(this.href)
window2.focus()
return false
}
else{
if (newwindow=="window2") document.links.onclick = "";
document.links.target = where;
}
}
}
}

function inithyperlinks(){
hyperlinks(true)
}

window.onload=inithyperlinks


If you don't have any icons available to assign to this script, I suggest downloading EasyPicture2Icon to create them. It's free.

User avatar
ftboomer
Avant Fanatic
Avant Fanatic
Posts: 295
Joined: Tue Sep 07, 2004 8:50 pm
Windows Version: Windows 7 x64
Avant Version: Latest
IE Version: IE8 x64
Location: Tampa, FL
Contact:

Post by ftboomer » Thu Mar 15, 2007 9:24 pm

Mine always open in a new tab with left click.. It's under options. Works or me everytime.

Avavt Options-->New Window.
Image
Give me a dirty martini and a great cigar, cause nothing beats a nice tight white ash!

Scrabble
Semi-Fan
Semi-Fan
Posts: 68
Joined: Sat Nov 18, 2006 10:36 pm
Windows Version: Windows
Avant Version:

Re: [Release] Make links open in a new tab

Post by Scrabble » Thu Mar 15, 2007 10:00 pm

Mine always open in a new tab with left click.. It's under options. Works or me everytime.

Avavt Options-->New Window.

The only options under Avant Options...New Window are:

Specifying the default action for the 'New' button and 'Ctrl+N' to open a new window for: blank page, current page, and home page.
Always create a new window for: Address Box, Bookmarks, RSS, Auto-Fill, Search Result, History, and Recently Closed.
Always create new browsing window in the: Foreground or Background.

None of these options include open links in a new window.



And I messed up on the instructions -- you do not need to select an icon since it is an auto-execute script.

User avatar
MysteryFCM
Administrator
Administrator
Posts: 7330
Joined: Tue Dec 09, 2003 2:34 am
Windows Version: 10, 8.0, 8.1, 7, Vista, XP
Avant Version: 13.00 Build 23
Default engine: Gecko
IE Version: 7.x, 8.x, 9.x, 10.x, 11.x
Skin: AthenX
Location: Newcastle Upon Tyne, UK
Contact:

Re: [Release] Make links open in a new tab

Post by MysteryFCM » Fri Mar 16, 2007 1:45 am

Scrabble wrote:
Mine always open in a new tab with left click.. It's under options. Works or me everytime.

Avavt Options-->New Window.

The only options under Avant Options...New Window are:
I don't have that option either ....

Scrabble
Semi-Fan
Semi-Fan
Posts: 68
Joined: Sat Nov 18, 2006 10:36 pm
Windows Version: Windows
Avant Version:

Post by Scrabble » Fri Mar 16, 2007 2:53 am

I don't have that option either ....
I don't think you understood when I said Avant Options...New Window.

It is the same as when ftboomer said Avavt Options-->New Window.

Just to be clear: Under 'Tools', go to 'Avant Browser Options', then 'New Window' is listed under "Category".

User avatar
MysteryFCM
Administrator
Administrator
Posts: 7330
Joined: Tue Dec 09, 2003 2:34 am
Windows Version: 10, 8.0, 8.1, 7, Vista, XP
Avant Version: 13.00 Build 23
Default engine: Gecko
IE Version: 7.x, 8.x, 9.x, 10.x, 11.x
Skin: AthenX
Location: Newcastle Upon Tyne, UK
Contact:

Post by MysteryFCM » Fri Mar 16, 2007 2:57 am

lol thats where I checked ;)

User avatar
hornakapopolis
AvantGuard
AvantGuard
Posts: 11321
Joined: Thu Jul 31, 2003 2:09 pm
Windows Version: Windows 10 Pro 64
Avant Version: 2015
Default engine: Chrome
IE Version: 11
Skin: Stickers
Location: Ohio, USA
Contact:

Post by hornakapopolis » Fri Mar 16, 2007 12:18 pm

I have a feeling this is a "links" vs "bookmarks/favorites" definition issue.

...and then a "I'm agreeing with you, but you don't realize it" issue.

:lol:

lacika
Newbie
Newbie
Posts: 3
Joined: Wed Apr 04, 2007 4:16 pm
Windows Version: Windows
Avant Version:
Location: Serbia

Post by lacika » Wed Apr 04, 2007 6:05 pm

HI,
I write this script and dont know how to do to open new tab window. It opens only if at least one tab is opened..

<script language="javascript">
window.open ("http://mail.yahoo.com","yahoomail");
</script>

Help!
Best regards

techno_freak
Newbie
Newbie
Posts: 7
Joined: Sun Aug 05, 2007 2:34 pm
Avant Version: 11.5 build 17

Re: [Release] Make links open in a new tab

Post by techno_freak » Tue Aug 07, 2007 4:20 am

Clicking on links opens empty tabs

Left-clicking on any hyperlinks in some websites doesnot open the page either in same/ new tab but opens a blank tab. Everytime I have to copy the shortcut and place it in address bar to open the link. I also do not have an option to open the link in a new tab in the right click dropdown menu - have only an option to do so only in a new window.
Looks like it happens for all sites with links having to open with javascript . Please let me know how I can have the links open up when I click on them
I am using the latest version of Avant v11 build 46 . The sames works fine with Internet Explorer. Cant understand why clicking on links does not open them in a new tab.

I however donot want all links to be opened in a new tab but only those links which are supposed to be opened so because of javascript;Other links should be opening in the same tab (which is the default behavior expected of any browser)
Is there any way out of this?

-Thanks in advance

Post Reply