Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created December 17, 2019 19:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/d6b995a4141b3e56f6b530cf08ca4aac to your computer and use it in GitHub Desktop.
Save tripflex/d6b995a4141b3e56f6b530cf08ca4aac to your computer and use it in GitHub Desktop.
Hide/Obfuscate/Mask Email Address from Spam Bots (Vue.js Component)
<template>
<span class="reverse">{{reversedEmail}}</span>
</template>
<script>
export default {
name: 'hide-email',
props: [ 'email' ],
computed: {
reversedEmail(){
return this.email.split("").reverse().join("")
}
}
}
</script>
<style scoped>
span.reverse {
unicode-bidi: bidi-override;
direction: rtl;
}
</style>
@tripflex
Copy link
Author

Basically the way this works is by using CSS to reverse the text (so it displays correctly), but to spam bots or harvesters, when looking at the source code they will see the email in reverse.

Based off suggestion here:
https://stackoverflow.com/questions/483212/effective-method-to-hide-email-from-spam-bots

@CavalcanteLeo
Copy link

but it doesn't work with cmd c (mac) or control C (windows)

Most of the user just copy e-mail like that, and never click it, to open the default e-mail app in computer.
Most of users prefer to use gmail or hotmail site instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment