Topic: External links

Hi there!

I'm new to PunBB and have installed it only on my local machine.

Is it possible to make a link in a post to open in a new window?

Thanks!

2

Re: External links

open %pundir%/include/parser.php

find

function handle_url_tag($url, $link = '')

find

return '<a href="'.$full_url.'">'.$link.'</a>';

change to

return '<a href="'.$full_url.'" target="_blank">'.$link.'</a>';
Hm... every pixel has it's own destiny

3

Re: External links

whereas the purists here say that this is not valid X- Y- or whatever-HTML.
Just to mention it wink

The German PunBB Site:
PunBB-forum.de

Re: External links

a xhtml valid (well kinda but not really) hack http://punres.org/doku.php?id=how-tos:o … new_window

Re: External links

Thank alot!
smile

6

Re: External links

Really the new window thing is a huge usability disadvantage.  It's just a no-no.

http://www.sitepoint.com/article/beware … new-window

Re: External links

Thanks for the interesting article. Made me consider whether I should do it or not... hmm

8

Re: External links

I always click links with my middle mouse button. using firefox this makes them appear in a new tab that loads in the background while I can continue to read the site I'm currently at. A lot of people I know do that.
Besides the fact that there is no JavaScript or HTML allowing to do this automatically - opening in a new tab works only with "normal" or targeted links. It often does not work with links tat open a new window with Javascript.
Therefore, I really appreciate links that do not open a window with JavaScript smile

The German PunBB Site:
PunBB-forum.de

Re: External links

Middle clicking links with target="_blank" or with the javascript punbb uses opens them in a new tab fine in firefox wink

BTW, i highly recommend the targetalert extension for firefox, which puts icons next to links (it can be set to show them on hover which is awesome) and is really nice so you can see if its gonna do something funky when you click it wink

10 (edited by Tobi 2005-10-19 17:28)

Re: External links

Connorhd wrote:

Middle clicking links with target="_blank" or with the javascript punbb uses opens them in a new tab fine in firefox wink

Do they? Havent' tested, but I prefer to avoid javaScript anyway because quite a few people have it switched off.

Connorhd wrote:

BTW, i highly recommend the targetalert extension for firefox, which puts icons next to links (it can be set to show them on hover which is awesome) and is really nice so you can see if its gonna do something funky when you click it wink

I'll give that a try. Sounds interesting. Any severe penalty on the page rendering time?

The German PunBB Site:
PunBB-forum.de

Re: External links

not that i've noticed.

Re: External links

Connorhd wrote:

a xhtml valid (well kinda but not really) hack http://punres.org/doku.php?id=how-tos:o … new_window

A better way to open links in new windows: New-Window Links in a Standards-Compliant World

If you want, you can add "anchor.title += ' - External link, opens in a new window';" to the script. You can also add an icon next to the link with "anchor.style.backgroundImage = some url;" (changing the paddingRight or paddingLeft property at the same time is a good idea, otherwise the icon will appear behind the text). If you want to use different icons for different document types (html, pdf, word etc), read the type attribute of the link before inserting the backgroundImage (switch(anchor.getAttribute('type'){ ... }).

Re: External links

i'm just using PunBBs method i didn't search for the "best" method.