<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aurelie Dufour on Medium]]></title>
        <description><![CDATA[Stories by Aurelie Dufour on Medium]]></description>
        <link>https://medium.com/@aure.dufour?source=rss-6a9eff394c91------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BS4aXB_5M4f8asQ5AgBbWQ.jpeg</url>
            <title>Stories by Aurelie Dufour on Medium</title>
            <link>https://medium.com/@aure.dufour?source=rss-6a9eff394c91------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 08:40:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aure.dufour/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Avoid spam messages by hiding your email address using HTML and JavaScript.]]></title>
            <link>https://medium.com/@aure.dufour/avoid-spam-messages-by-hiding-your-email-address-using-html-and-javascript-6751549a73a1?source=rss-6a9eff394c91------2</link>
            <guid isPermaLink="false">https://medium.com/p/6751549a73a1</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Aurelie Dufour]]></dc:creator>
            <pubDate>Mon, 25 Jan 2016 02:42:26 GMT</pubDate>
            <atom:updated>2016-01-25T02:42:26.887Z</atom:updated>
            <content:encoded><![CDATA[<p>Do you know that there are 54 billion spam messages sent every day? Spammers use harvested email addresses published on websites. You would like yours to be visible on your website, but you would like to avoid receiving any additional junk-mail. I am going to show you two ways to hide your email from the bots, but make it public to your viewers.</p><h4><strong>How does it work?</strong></h4><p>The spambots are using your HTML, which contains your website information, to find any personal data and email addresses. But they have a flaw, they are not able to read CSS. We are going to use that weakness to protect your website from those intruders.</p><h4><strong>Make an email visible for the user, not the spambots.</strong></h4><p>With this technique, you will be able to show your email address for you viewer.</p><p>By using two CSS selectors, we are hiding part of the email address so it won’t appear as one element that’s easy to grab.</p><p>We are going to use the pseudo-selectors <strong>::before</strong> and <strong>::after</strong>, and the attributes <strong>data-user</strong> and <strong>data-domain</strong>.</p><p>Let me explain…</p><h4>Pseudo-selector and data-attribute</h4><p>The <strong>::before</strong> selector inserts something before the html element when viewed in the website page, and the <strong>::after </strong>selector, I’ll let you guess, inserts something after.</p><p>If you aren’t familiar with those notions, I invite you to read Sara Code’s article <a href="https://css-tricks.com/almanac/selectors/a/after-and-before/">here</a>.</p><p>The <strong>data-*</strong> attributes allows you to store invisible additional information on a html element. <a href="https://developer.mozilla.org/en/docs/Web/Guide/HTML/Using_data_attributes">Here</a> is an article about the data attribute.</p><p>We are going to use the following formula:</p><p><strong>::before</strong> ”attribute <em>data-user</em>” my email @ <strong>::after</strong>”attribute <em>data-domain </em>”</p><p><strong>Step one</strong> : In the HTML file, we are going to add the attribute data-domain (hellocanada.com) and the data-user (justintrudeau) to our my-email element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/0*UGOkDRpWsVZnN3mC." /></figure><p><strong>Step two</strong>: In the CSS file, we are going to use the pseudo selector <strong>::before</strong>, <strong>::after</strong> to add the content of the data-domain and the data-user to our my-email element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/0*KMTuj2WQqNbaDnMS." /></figure><p>Our code should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*ZInz0YTBgHXRFLyk." /></figure><p>The result is your email address on your website!</p><p>This method is great if you want to show your email, but how to make your email a link?</p><h4>Make a secure email link via Javascript</h4><p>Now, we would like to create an hyperlink using the attribute <strong>mailto</strong>.</p><p>We are going to use two simple javascript lines that are going to replace the symbols <strong>dot</strong> and <strong>@</strong> with text. The principle stays the same, a bot won’t be able to grab the email by reading the html.</p><p><strong>Step One</strong>: Create a link with the <strong>a</strong> element and the attribute <strong>mailto:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/0*OffYJkUMVtBcxxxD." /></figure><p><strong>Step Two</strong> : We are now going to change the <strong>@</strong> for <strong>AT </strong>and the <strong>.</strong> for <strong>dot</strong>.</p><p>example &lt;a <a href="/service/mailto:justinTrudeau@hellocanada.com">mailto:justintrudeau@hellocanada.com</a>&gt;</p><p>is now &lt;a mailto:justintrudeau<strong>AT</strong>hellocanada<strong>DOT</strong>com&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/0*jeWWoQFTq27EwToo." /></figure><p><strong>Step Three</strong>: We are adding two lines of javascript to replace the text by the symbols.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/0*a5rBRzrNoacO6bUr." /></figure><p>To make it even more difficult for the bots, we are using the <a href="http://www.w3schools.com/charsets/ref_html_8859.asp">ISO</a> reference for our symbols .</p><p>Now your users can sent you an email, and you can keep your mind at peace!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F8XUt7LilKZwOc%2Ftwitter%2Fiframe&amp;src_secure=1&amp;url=http%3A%2F%2Fgiphy.com%2Fgifs%2F8XUt7LilKZwOc&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F8XUt7LilKZwOc%2Fgiphy.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="243" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b7ebce665b9dcc2f6868112976058b8/href">https://medium.com/media/5b7ebce665b9dcc2f6868112976058b8/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6751549a73a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>