GuildPortal will be going offline (permanently) by the end of the month.
Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Voodoo Tech and Scripter's Den of Scriptniquity > Default Link behavior in Forum Posts
Corganno (New Admin) 7/30/2011 8:38 AM EST : Default Link behavior in Forum Posts
Posts: 584
Zomgawsh Poster

Is there a way to change the default hyperlink behavior for forum posts?  I'd love to make it have all links open up in a new window, unless a different selection is made by the poster.

I've found where you can change this, per link, when posting, but by default it just uses the same window and no one ever sets it manually. 

I had been using some java script (in the 
Custom Javascript/jQuery - Additional Functions window) to do it in the past, but suddenly it's not working anymore. Any ideas? 

This was the code that I was using:

*Edit: Removed the coding I was using from forum post, Mottie's code is much better*

Mottie (MVP) 8/1/2011 8:04 PM EST : RE: Default Link behavior in Forum Posts
GuildPortal MVP
Posts: 3884
Zomgawsh Poster

Hi Corganno! Try this:

Open External Forum Links in a New Tab

This script searches for any link inside the forum posts and makes it open in a new tab/window. Additionally, it adds a css class name of "external-link" so you can style the link differently. In the example below, it adds an external link icon after the link.

Ideally, add the following code to a Free Form Text/HTML widget on the Forums Page. But you could also add it to the Footer HTML (Control Panel > Custom HTML & Script > Footer Area).
a.external-link {
  background: url( top right no-repeat;
  var guild = 'GuildID=' + getGroupId();
  $('.MessageBodyCell1 a').each(function(){
    if (this.href && !this.href.match(guild)){
  • Change or remove the background image by modifying the image url in orange. Adjust the padding-right in red to fit the image.
  • If you want to modify the link color, do it as follows:
     .external-link:link { color: #ffcc00; }
     .external-link:hover { color:
    #ffffff; }
     .external-link:visited, .external-link:active { color:
    #ff8800; }
    Modify the link colors in blue as desired.

Admins Online
There are   members online.
So-and-so has logged on!