I noticed that GitHub appends a js that seems to remove links to email addresses when they have the string /cdn-cgi/l/email-protection
with them. Any one else having this strange issue or is this even really from GitHub?
Here is the prettified version of this script:
(function() {
try {
var s, a, i, j, r, c, l = document.getElementsByTagName("a"),
t = document.createElement("textarea");
for (i = 0; l.length - i; i++) {
try {
a = l[i].getAttribute("href");
if (a && a.indexOf("/cdn-cgi/l/email-protection") > -1 && (a.length > 28)) {
s = '';
j = 27 + 1 + a.indexOf("/cdn-cgi/l/email-protection");
if (a.length > j) {
r = parseInt(a.substr(j, 2), 16);
for (j += 2; a.length > j && a.substr(j, 1) != 'X'; j += 2) {
c = parseInt(a.substr(j, 2), 16) ^ r;
s += String.fromCharCode(c);
}
j += 1;
s += a.substr(j, a.length - j);
}
t.innerHTML = s.replace(/</g, "<").replace(/>/g, ">");
l[i].setAttribute("href", "mailto:" + t.value);
}
} catch (e) {}
}
} catch (e) {}
})();
When I have a link like <a href="mailto:/cdn-cgi/l/email-protection/[email protected]">Contact</a>
it becomes <a href="mailto:">Contact</a>
. Otherwise, it does not do anything. Still, this bothers me because I did not put that script there yet there it is and I didn't seem to get any warning about GH appending scripts.
Optimising assets can significantly improve load times for visitors to your site. When you build a site on CloudCannon, any assets referenced in your HTML/CSS are automatically minified and served from a CDN. JavaScript files are minified using UglifyJS.
I just got a response from GitHub support and it turns out the mysterious script was being added by CloudFlare when Email Address Obfuscation
feature is turned on.
Relevant settings are on https://www.cloudflare.com/a/content-protection/<<domain.name>>
under ScrapeShield
, if anyone has similar troubles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With