×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: UBB-Link to open in new window?

UBB-Link to open in new window? 14 years 9 months ago #8761

  • Nils Ally
  • Nils Ally's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 299
  • Thank you received: 33
Just wondering...
When creating a link in the comments, how do you make the link so it opens in a new window, rather than automatic _self?

I have tried digging into searching Google, but it seems a tag or whatever doesn't exist.

So when I try, by using regular html method (target="_blank";), well, that didn't work (obviously really), as the " gets converted to "

On the offchance that it might work, I tried, and failed.

Anyway of doing this?
I know that Forums also use UBB-Code, and links open in a new window, but it doesn't show the code being used for it.
So, I assume it is something in the file handeling in the programme. Anyway of changing/hacking this?

UBB-Link to open in new window? 14 years 9 months ago #8773

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48

that didn't work (obviously really), as the " gets converted to "

Slightly obvious... that's the new XSS protection code at hard work of course! :laugh:

Here's what you gotta do - In file components\com_comment\joscomment\comment.class.php search for this line:
return "<a href='". JOSC_ubbcode::preventXSS($url)."' rel='external nofollow' title='".$text."'>".$text."</a>";

Add the target='_blank' there ;)

OK, next version will have an option "Offsite links open in a new window" with a Yes/No selection, YES default. This is behavior of all popular blog/websites as far as I know and makes complete sense to me =)

Cheers!

UBB-Link to open in new window? 14 years 9 months ago #8774

  • Nils Ally
  • Nils Ally's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 299
  • Thank you received: 33
Great stuff! Thanks. :)

Don't know how difficult it is, or even if it is necessary, but some people may be using the wrapper functionality of Joomla.
I have never used that myself, but I understand it as a form of frame.

Anyway, the point is, perhaps it may be an idea to add the normal alternatives, _blank, _parent, _self and _top?

UBB-Link to open in new window? 14 years 9 months ago #8823

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
I don't agree with you Jonus!
The latest thing in web development is that you don't have to force the user! So setting the link to open in new windows is forcing the user to accept the behavior you've created.

If you also look at xhtml strict or transitional (I think it was one of them) specifications you will see that you are not allowed to set the target tag anymore - it is deprecated ;)

UBB-Link to open in new window? 14 years 9 months ago #8849

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
Daniel Dimitrov wrote:

I don't agree with you Jonus! The latest thing in web development is that you don't have to force the user!

That's a good point. Unlike desktop programming we should never assume anything. And in the spirit of open source we should have that maximum flexibility (options for everything).

I just looked it up, yes you are right - it is depreciated in Strict HTM and XHTML, but for some reason it's not mentioned on w3schools.

Forced New-Window links with target="_blank" is against accessibility standards for web design, it's only a matter of time before all Code Validators are updated to say "No-no" at every target tag. Although I imagine this would create valid code for every browser:
<a href="http://www.google.com.au" onclick="window.open(this.href);">Google Australia in a new browser window</a>
  • Page:
  • 1
Time to create page: 0.118 seconds