MyBB Community Forums

Full Version: External Links
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It would be a very neat feature to have an external link icon displayed next to all external links by default. Of course it could have the option to have it disabled. Just a very minor change that could make a large difference.

ALSO... Have the ability to bring a splash page when visiting an external site that says "You are about to visit an external site... We are not responsible..." Something like that.
I don't really see why in all honesty. Browsers will show you where the link goes when you put your mouse over it.
Yeah but it would be for quick convenience. Original post has more stuff
I think it should be a plugin if anything personally.
That can also be done with a custom MyCode.
ACP > Configuration > MyCode > Add MyCode.
Title: External links
Description: Adds an icon to external links
Regular expression:
\<a(.*?)href=\"((?!http://www.yourdomain.com/).*?)\"(.*?)\>(.*?)\<\/a\>
Replacement:
<a$1href="$2"$3>$4<img src="images/external_link.gif" /></a>

Make sure you change the domain to your domain in regular expression and change the image name/location in the replacement.
That's neat, I will use that, thanks.
(2011-05-31, 08:24 AM)Aries-Belgium Wrote: [ -> ]That can also be done with a custom MyCode.
ACP > Configuration > MyCode > Add MyCode.
Title: External links
Description: Adds an icon to external links
Regular expression:
\<a(.*?)href=\"((?!http://www.yourdomain.com/).*?)\"(.*?)\>(.*?)\<\/a\>
Replacement:
<a$1href="$2"$3>$4<img src="images/external_link.gif" /></a>

Make sure you change the domain to your domain in regular expression and change the image name/location in the replacement.

Hi, I did that but it adds an image to internal links, too.

EDIT: Solved. You have to remove the slash after your domain name. The correct regular expression is this:
\<a(.*?)href=\"((?!http://www.yourdomain.com).*?)\"(.*?)\>(.*?)\<\/a\>

Cheers
Next issue, the code above only works with one domain, but how can I make it work with subdomains? I want links to my subdomains appear like internal links.