Mobile app version of vmapp.org
Login or Join
Candy875

: Email obfuscated in HTML page I am trying to design a page based on simple material design lite - similar to this page: http://fxpblog.co/firefox/nightly/. If you look in line 380 of source

@Candy875

Posted in: #EmailAddress #Html5 #Hyperlink

I am trying to design a page based on simple material design lite - similar to this page: fxpblog.co/firefox/nightly/.
If you look in line 380 of source code the email address is given but it is obfuscated. Whenever I try the same I just copy and paste the whole section it does not work for me.
My template page looks like this: codepen.io/anon/pen/qNybqN.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Candy875

2 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

This is not what i would call obfuscation - that is just encoding of entities. If you really want to obfuscate the email address use something like this:

<script>
function hide(id) {
document.location = id.replace(/|/g, '');
}
</script>

<button class="btn btn-default" data-to="mailto:john@|doe|.|org" onclick="document.location=this.dataset.to.replace(/|/g, '')">
E-Mail
</button>


Look at jsbin.com/takesixazu/edit?html,js,output, how it works: you divide the string you want to obfuscate, and then put it together through user action.

10% popularity Vote Up Vote Down


 

@Jamie184

That text (value of the anchors href attribute) is simply HTML entity encoded. (Although I'm not convinced how effective that would be today to prevent the email being harvested.)


Should I encode it first and put it in the source?


Yes, you need to encode it first - it doesn't get automatically encoded (unless you are using some kind of framework/CMS that does this for you). Most server-side languages have functions built-in for HTML encoding/decoding.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme