[TYPO3] Mark external links

Robert Markula robert.markula at gmx.net
Mon Jul 10 22:42:20 CEST 2006


Christopher wrote:
> 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...

Hi Christopher,
Your javascript solution is very elegant, but unfortunately exactly this 
is the bait: we must not use any javascript except for 
spamProtectEmailAddresses.
I've searched quite a bit to solve this issue (it *can* be solved, it's 
absolutely possible to automate this), but did not find an answer so 
far. Perhaps I'm looking at this from a wrong angle?

<puzzled>Ro</puzzled>



More information about the TYPO3-english mailing list