Safe way of Email On Web Pages | SEO

Jyotishgher Astrology
By -
0
Safe way of Email On Web Pages |  SEO 

You have a website, you want to put your email address on the site so that people can contact you easily but you are also worried about spam flooding your mailbox once your email address begins to appear on a public web page

Using the ‘onclick’ event

You can create a regular mailto hyperlink for your email address but replace some of the characters – like the dot and the @ sign – with text. Then add an onclick event to this hyperlink that will substitute the text with the actual symbols.

<a href = "mailto:careATgmailDOTcom" onclick = "this.href=this.href .replace(/AT/,'&#64;') .replace(/DOT/,'&#46;')" >Contact Me</a>

2b. Random Array

Split your email address into multiple parts and create an array in JavaScript out of these parts. Next join these parts in the correct order and use the .innerHTML property to add the email address to the web page.
<span id="email"></span>

<script>
  var parts = ["john", "abc", "com", "&#46;", "&#64;"];
  var email = parts[0] + parts[4] + parts[1] + parts[3] + parts[2];
  document.getElementById("email").innerHTML=email;
</script>

Post a Comment

0Comments

Post a Comment (0)