Project

General

Profile

Actions

Feature #81939

open

Allow right click and copy for spam protected email addresses

Added by Neil Haskins almost 7 years ago. Updated about 1 year ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2017-07-21
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Currently, if someone right clicks and copies a spam protected email address, they get javascript:linkTo_UnCryptMailto('sdfgserwhatevereteggh');
For email where the link text is not the address, I could see those who don't use an email client being unsure of how to get the address.

What I've experimented with is triggering a function on opening the context menu, to replace the href contents with the correct email.

Example here: https://jsfiddle.net/nhaskins/1nk7ky75/2/

I've tested this in TYPO3 by adding the following function to typo3/sysext/frontend/Classes/Page/PageGenerator.php at line 756 (end of $scriptJsCode)

function UnCryptMailto(el) {
    var str = el.getAttribute("href").split("\'")[1];
    el.setAttribute("href", decryptString(str,' . $tsfe->spamProtectEmailAddresses * -1 . '));
    el.removeAttribute("oncontextmenu");
}

and the following in typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php at line 5646 (just before $tagAttributes = [];)

if ($tsfe->spamProtectEmailAddresses) {
    $finalTagParts['aTagParams'] .= ' oncontextmenu="UnCryptMailto(this)"';
}

I'm pretty sure this isn't the best way to include the oncontextmenu attribute, and it looks like it would need to be added to at least the f:link.email viewhelper as well.


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Bug #101228: Mailto link decryption vs. manipulated DOMClosed2023-07-04

Actions
Related to TYPO3 Core - Story #94904: Is spamProtectEmailAddresses still worth keeping around?New2021-08-16

Actions
Actions

Also available in: Atom PDF