Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Is there any WebApp that allows you to publish an e-mail on the web using a script tag that protects it from robots?

To be more clear: I want to publish a post on Blogspot that prints my e-mail on the screen as a selectable and copyable text, but hides it from the HTML source code. This is an anti-spam technique.

I imagine the solution is some javascript that fetches the e-mail address from a server, or that decrypts it from existing data. I know this could be a programming question if the solution doesn't need no server-side programming, but I'm not sure about this.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

There are a bunch of sites that generate the code. It generally entails breaking up the email address into a few variables, and then writing them to the screen. Simple example:

<script type="text/javascript">
    dot = "."
    part1 = "john"
    part2 = "doe"
    part3 = "gma"
    part4 = "il"
    part5 = "co"
    part6 = "m"

    document.write( part1 + dot + part2 + "@" + part3 + part4 + dot + part5 + part6

    //returns john.doe@gmail.com
</script>

More complex options will convert each letter into the HTML element.

Check out http://www.mobilefish.com/services/hideemail/hideemail.php#hideemail_input as an example

share|improve this answer
    
I like the service you linked because I don't have to code to use it. But I also would like to see more services like it. –  Jader Dias Oct 13 '10 at 2:43
1  
There are a bunch out there. Search for things like email obfuscation, javascript anti-spam email address, etc. Add the word "generator" on to the search if you just want an app and not the tutorial part. Glad to help! –  hookedonwinter Oct 13 '10 at 2:47
add comment

We use a VB Function to generate the mail addresses. It encodes the addresses to UTF-8 or hex. You can convert it to any language you wish. This is the VB.NET code:

' Convert An Input String To Unicode Character Codes
Public Enum CloakType
    UTF8_1
    UTF8_2
    HEX_1
    HEX_2
    UniCode
End Enum

Public Function CloakIt(ByVal inTxt As String, ByVal iType As CloakType) As String
    Dim iInd As Integer
    Dim sOut As String
    sOut = ""
    If Len(inTxt) = 0 Then
        CloakIt = ""
        Exit Function
    End If
    For iInd = 1 To Len(inTxt)
        Select Case iType
            Case CloakType.UTF8_2 ', 2
                ' Long UTF-8 encoding without semicolons
                sOut = sOut & "&#" & Right("0000000" & CStr(Asc(Mid(inTxt, iInd, 1))), 7)
            Case CloakType.HEX_1 ', 3
                ' Hex encoding without semicolons
                sOut = sOut & "&#x" & Hex(Asc(Mid(inTxt, iInd, 1)))
            Case CloakType.HEX_2 ', 4
                ' Hex encoding with semicolons
                sOut = sOut & "&#x" & Hex(Asc(Mid(inTxt, iInd, 1))) & ";"
            Case CloakType.UniCode ', 5
                ' Unicode 2 Byte Hex encoding with semicolons
                sOut = sOut & "&#x00" & Hex(Asc(Mid(inTxt, iInd, 1))) & ";"
            Case Else
                ' UTF-8 Unicode Encoding
                sOut = sOut & "&#" & CStr(Asc(Mid(inTxt, iInd, 1))) & ";"
        End Select
    Next
    CloakIt = sOut
End Function
share|improve this answer
add comment

I use the Hivelogic enkoder.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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