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!
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 discussion → 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!
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>';
whereas the purists here say that this is not valid X- Y- or whatever-HTML.
Just to mention it
a xhtml valid (well kinda but not really) hack http://punres.org/doku.php?id=how-tos:o … new_window
Thank alot!
Really the new window thing is a huge usability disadvantage. It's just a no-no.
Thanks for the interesting article. Made me consider whether I should do it or not...
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
Middle clicking links with target="_blank" or with the javascript punbb uses opens them in a new tab fine in firefox
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
Middle clicking links with target="_blank" or with the javascript punbb uses opens them in a new tab fine in firefox
Do they? Havent' tested, but I prefer to avoid javaScript anyway because quite a few people have it switched off.
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
I'll give that a try. Sounds interesting. Any severe penalty on the page rendering time?
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'){ ... }).
i'm just using PunBBs method i didn't search for the "best" method.
PunBB Forums → PunBB 1.2 discussion → External links
Powered by PunBB, supported by Informer Technologies, Inc.