Skip to:

“Target” attribute in all post urls?

  • Anyone know how I might go about adding the target attribute to all <a> elements on my forum? I’d like to keep users there when they are sent to other sites/pages.


Viewing 3 replies - 1 through 3 (of 3 total)
  • I assume the same way as you would in WordPress – using filters for when the text is called from the db, then going through the text looking for links and adding them?

    I don’t know what filter there are, though, so I can’t tell you which one to call.

    In the long run you’ll keep users more friendly if you don’t dictate how they browse. Most people (even my mum) know about tabbed browsing now and know to middle click to open a link in a background tab.

    Also, FWIW, target is not (and never has been) a standard attribute of HTML4 or XHTML, so if you want your pages to validate, avoid it.

    Having said that… :) The Google Analytics plugin for BBPress filters the content and adds stuff to the anchors, so that should help:

    Sam Bauers


    You could use javascript to add an onclick event to anchors within the threads DOM object.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar