http://www.KoolBear.com" onclick="window.open(this.href);return false; if mod works link should open in a new window or tab.
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 9:09 am
by Spidey
Opened in new window.
IE
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 9:39 am
by Isaac
Opened in a new tab. Chrome 9.0.597.84 Linux
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 9:52 am
by KoolBear
The forums should open in a new window or tab too.
Any other links that we think should open in a new window please point them out. I know I need to get the BBCode link this is the link that shows up within the Post Topic page. Man that's a frustrating one to hit while you are editing
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 10:54 am
by Isaac
This feature is one of my favorite things about this forum. Just about all the others I use don't have this.
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 1:03 pm
by fliptw
why are you using javascript? target="_blank" will work
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 1:26 pm
by KoolBear
I'm not doing anything it's the way phpbb is assembling the url it in the program... and obviously I'm not a programmer.
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 1:28 pm
by KoolBear
Isaac wrote:This feature is one of my favorite things about this forum. Just about all the others I use don't have this.
lol, that;s because most forums since 2008 have been using the new version of phpbb
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 2:26 pm
by Krom
An alternative if you are a Firefox user is to install greasemonkey and set this as a user script:
// ==UserScript==
// @name DescentBB.net set link target attribute
// @namespace descentbb.net
// @description Fix the target of hyperlinks so they open in a new tab/window
// @include http://descentbb.net/viewtopic.php*
// @include http://www.descentbb.net/viewtopic.php*
// ==/UserScript==
var a = document.getElementsByTagName('a');
for (i = 0; i < a.length; i++) a[i].setAttribute('target','_blank');
The added bonus is you can edit in more: // @include http://someotherphpbbsite.com" onclick="window.open(this.href);return false; to make other phpbb3 based forums behave the same way. Or you can edit the script and replace the '_blank' with '_self' to reverse the behavior on sites that use new tabs/windows when you don't want them to.
Also with a little tweaking of the browser Google Chrome users can use this script too.
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 3:10 pm
by KoolBear
Nice, any odea why XHTML dropped it? I guess it's a legacy feature and it has been replaced by something else?
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 3:27 pm
by Aus-RED-5
KB, it's works.
Thank you!
Re: Testing open in new window/tab modification
Posted: Wed Feb 09, 2011 4:32 pm
by fliptw
KoolBear wrote:Nice, any odea why XHTML dropped it? I guess it's a legacy feature and it has been replaced by something else?
Its valid in transitional XHTML/HTML4, but not the strict versions.
Its back in HTML5. Go figure. I wonder if they had second thoughts on that one.
Re: Testing open in new window/tab modification
Posted: Thu Feb 10, 2011 2:23 am
by Aus-RED-5
hummm... The link to KB's website opened in a new tab, but why didn't this one do the same?
EDIT: Well I ended up using Krom's suggestion. It works too, but if click on New Post, New Reply, PM, Quote or even Edit (pretty much anything with a link). They will be opened in a new tab.... Doh! Not sure I like this!
Re: Testing open in new window/tab modification
Posted: Thu Feb 10, 2011 6:59 am
by KoolBear
did you just paste the url straight in or did u enter the bbcode?
This is the url only pasted below... " onclick="window.open(this.href);return false;
EDITED 2/10/11 10am cst
Sorry my bad that was a stupid question obviously you used the bbcode, let me see what else I can do:P
Re: Testing open in new window/tab modification
Posted: Thu Feb 10, 2011 8:21 am
by Krom
Yeah, that is the one downside of the script; its an all or nothing setting.
// ==UserScript==
// @name DescentBB.net set link target attribute
// @namespace descentbb.net
// @description Fix the target of hyperlinks so they open in a new tab/window
// @include http://descentbb.net/viewtopic.php*
// @include http://www.descentbb.net/viewtopic.php*
// ==/UserScript==
var a = document.getElementsByTagName('a');
for (i = 0; i < a.length; i++) if(a[i].className=='postlink') a[i].setAttribute('target','_blank');
Re: Testing open in new window/tab modification
Posted: Thu Feb 10, 2011 12:22 pm
by Krom
fliptw wrote:try this:
That works perfectly, good idea on checking the class name.
One question then, is it possible to run that script automatically by editing it into the header without requiring an extra browser plugin?
Re: Testing open in new window/tab modification
Posted: Thu Feb 10, 2011 12:34 pm
by fliptw
You can.
Re: Testing open in new window/tab modification
Posted: Thu Feb 10, 2011 12:37 pm
by KoolBear
fliptw wrote:You can.
Will you share and I'll edited into the header.
Re: Testing open in new window/tab modification
Posted: Thu Feb 10, 2011 12:43 pm
by fliptw
Go ahead. Just put that code between the script tags and its golden.
Re: Testing open in new window/tab modification
Posted: Thu Feb 10, 2011 12:49 pm
by KoolBear
fliptw wrote:Go ahead. Just put that code between the script tags and its golden.
kool beans thanks
Re: Testing open in new window/tab modification
Posted: Thu Feb 10, 2011 1:50 pm
by Krom
If that script works KB, you should probably remove the board modification you were trying just to play it safe.
Oh, and if you do put it in, you only need the two bottom lines, all the stuff at the top that starts with the // is irrelevant for a script that is built into the page.
Re: Testing open in new window/tab modification
Posted: Thu Feb 10, 2011 2:42 pm
by KoolBear
Krom wrote:If that script works KB, you should probably remove the board modification you were trying just to play it safe.
Oh, and if you do put it in, you only need the two bottom lines, all the stuff at the top that starts with the // is irrelevant for a script that is built into the page.