0

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 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: http://codepen.io/anon/pen/qNybqN.

5
  • What do you mean "it does not work"? If you copy/paste that exact section then you should get the exact same result? No? That email address is simply HTML entity encoded - although I'm not convinced how effective that would be today to prevent the email being harvested. (?) – MrWhite Jul 29 '16 at 8:43
  • I meant that if I view page source in "Firefox or Chrome", the code I pasted displays the email address in plain-text. But the code from fxpblog does the 'HTML entity encoding'. How can I make my code also do the so-called HTML entity encoded. – Schultz Hartmut Jul 29 '16 at 8:47
  • That doesn't make a whole lot of sense - there really shouldn't be any difference between yours and theirs, providing you are really using HTML encoded text in the page source. It sounds like you are perhaps viewing your HTML through the browsers object inspector (which will decode any HTML entities), rather than "View page source"? But presumably you are viewing the other page in the same way? – MrWhite Jul 29 '16 at 8:54
  • Should I encode it first and put it in the source? I assumed it gets automatically encoded. I am using Tools->Web Dev -> Page Source. – Schultz Hartmut Jul 29 '16 at 8:59
  • Questions about web coding belong on Stackoverflow, not ProWebmasters. webmasters.stackexchange.com/help/on-topic – Rob Jul 29 '16 at 12:56
1

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.

0

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 http://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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.