[TYPO3] Mark external links
Christopher
bedlamhotel at gmail.com
Mon Jul 10 22:13:39 CEST 2006
Hi Robert,
On 7/10/06, Robert Markula <robert.markula at gmx.net> wrote:
> Kenneth Bo Larsen wrote:
> > Hi again Robert
> >
> > Nice to hear that you found a solution..
> >
> > Regarding the image in mail-links..i found this post about RTE
> > configuration on the list.
> > Dont know if its usefull but maybe you can see something in it for you
> > to use:
I don't know if it's an option for you, but this is relatively easy to
achieve in javascript. You'd do something like this:
function markExternalLinks() {
var linkCollection = document.getElementsByTagName('a');
for(var i=0;i<linkCollection.length;i++) {
var href = linkCollection[i].href;
var domain = href.search('domain.tld');
var mailto = href.search('mailto');
if (domain == -1 && mailto == -1) {
linkCollection[i].className = 'externalLink';
}
}
}
You'd just have to swap 'domain.tld' for your own domain, maybe add
another test for links like href="javascript:foo();" and set the
script up to run on page load. Of course it wouldn't work when your
visitors have javascript disabled...
-Christopher
More information about the TYPO3-english
mailing list