Testing open in new window/tab modification
- KoolBear
- DBB Co-Founder
- Posts: 10132
- Joined: Thu Nov 05, 1998 12:01 pm
- Location: Houston, TX USA
- Contact:
Testing open in new window/tab modification
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
Opened in new window.
IE
IE
Re: Testing open in new window/tab modification
Opened in a new tab. Chrome 9.0.597.84 Linux
❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉
-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-★ ·:*¨༺꧁༺ ༻꧂༻¨*:·.★-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-
❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉
-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-★ ·:*¨༺꧁༺ ༻꧂༻¨*:·.★-⎽__⎽-⎻⎺⎺⎻-⎽__⎽--⎻⎺⎺⎻-
❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉❉⊱•═•⊰❉⊱•═•⊰❉⊱•═•⊰❉
- KoolBear
- DBB Co-Founder
- Posts: 10132
- Joined: Thu Nov 05, 1998 12:01 pm
- Location: Houston, TX USA
- Contact:
Re: Testing open in new window/tab modification
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
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
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
why are you using javascript? target="_blank" will work
- KoolBear
- DBB Co-Founder
- Posts: 10132
- Joined: Thu Nov 05, 1998 12:01 pm
- Location: Houston, TX USA
- Contact:
Re: Testing open in new window/tab modification
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.
- KoolBear
- DBB Co-Founder
- Posts: 10132
- Joined: Thu Nov 05, 1998 12:01 pm
- Location: Houston, TX USA
- Contact:
Re: Testing open in new window/tab modification
lol, that;s because most forums since 2008 have been using the new version of phpbbIsaac wrote:This feature is one of my favorite things about this forum. Just about all the others I use don't have this.
- Krom
- DBB Database Master
- Posts: 16125
- Joined: Sun Nov 29, 1998 3:01 am
- Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
- Contact:
Re: Testing open in new window/tab modification
An alternative if you are a Firefox user is to install greasemonkey and set this as a user script:
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.
Code: Select all
// ==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');
Also with a little tweaking of the browser Google Chrome users can use this script too.
- KoolBear
- DBB Co-Founder
- Posts: 10132
- Joined: Thu Nov 05, 1998 12:01 pm
- Location: Houston, TX USA
- Contact:
Re: Testing open in new window/tab modification
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
Its valid in transitional XHTML/HTML4, but not the strict versions.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 back in HTML5. Go figure. I wonder if they had second thoughts on that one.
- Aus-RED-5
- DBB Friend
- Posts: 1604
- Joined: Fri Apr 23, 2004 7:27 am
- Location: Adelaide, South Australia
- Contact:
Re: Testing open in new window/tab modification
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!
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!
Prepare for DESCENT!
- KoolBear
- DBB Co-Founder
- Posts: 10132
- Joined: Thu Nov 05, 1998 12:01 pm
- Location: Houston, TX USA
- Contact:
Re: Testing open in new window/tab modification
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
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
- Krom
- DBB Database Master
- Posts: 16125
- Joined: Sun Nov 29, 1998 3:01 am
- Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
- Contact:
Re: Testing open in new window/tab modification
Yeah, that is the one downside of the script; its an all or nothing setting.
Re: Testing open in new window/tab modification
try this:
Code: Select all
// ==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');
- Krom
- DBB Database Master
- Posts: 16125
- Joined: Sun Nov 29, 1998 3:01 am
- Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
- Contact:
Re: Testing open in new window/tab modification
That works perfectly, good idea on checking the class name.fliptw wrote:try this:
One question then, is it possible to run that script automatically by editing it into the header without requiring an extra browser plugin?
- KoolBear
- DBB Co-Founder
- Posts: 10132
- Joined: Thu Nov 05, 1998 12:01 pm
- Location: Houston, TX USA
- Contact:
Re: Testing open in new window/tab modification
Will you share and I'll edited into the header.fliptw wrote:You can.
Re: Testing open in new window/tab modification
Go ahead. Just put that code between the script tags and its golden.
- KoolBear
- DBB Co-Founder
- Posts: 10132
- Joined: Thu Nov 05, 1998 12:01 pm
- Location: Houston, TX USA
- Contact:
Re: Testing open in new window/tab modification
kool beans thanksfliptw wrote:Go ahead. Just put that code between the script tags and its golden.
- Krom
- DBB Database Master
- Posts: 16125
- Joined: Sun Nov 29, 1998 3:01 am
- Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
- Contact:
Re: Testing open in new window/tab modification
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.
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.
- KoolBear
- DBB Co-Founder
- Posts: 10132
- Joined: Thu Nov 05, 1998 12:01 pm
- Location: Houston, TX USA
- Contact:
Re: Testing open in new window/tab modification
otay buckwheatKrom 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.
- Aus-RED-5
- DBB Friend
- Posts: 1604
- Joined: Fri Apr 23, 2004 7:27 am
- Location: Adelaide, South Australia
- Contact:
Re: Testing open in new window/tab modification
Thanks fliptw, that worked!fliptw wrote:try this..........
Prepare for DESCENT!