• I want to hide email adresses as much as we can on a site I made for a friend.

    I use a little utility called ‘Email Obfuscator’ to generate the code. The code below is what I get if I choose Javascript.

    <script>document.write(‘T’+’e’+’x’+’t’+’ ‘+’i’+’n’+’ ‘+’t’+’h’+’e’+’ ‘+’l’+’i’+’n’+’k’);</script>

    However it does not seem to work, all I see on the site is this code. What do I do wrong?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator cubecolour

    (@numeeja)

    you could use one of the existing anti-spambot plugins for this.
    see: http://codex.wordpress.org/Protection_From_Harvesters#Use_Anti_Spam_Plugins

    Thread Starter ChangeAgent

    (@changeagent)

    Thanks, yes I was aware of these.

    Tested them all and was not to happy with how they functioned. that is why I was looking for an other option.

    As I am not a coder myself, I thought I might be making a simple coding error.

    Thread Starter ChangeAgent

    (@changeagent)

    I have been checking a bit more, and when I paste

    <script>document.write(‘T’+’e’+’x’+’t’+’ ‘+’i’+’n’+’ ‘+’t’+’h’+’e’+’ ‘+’l’+’i’+’n’+’k’);</script>

    it is there. I save it, it is still there. I close the ‘Text’ window and open the ‘Visual’ window and back to ‘Text’ window and the code has changed to:

    <script>// <![CDATA[
    document.write(‘T’+’e’+’x’+’t’+’ ‘+’i’+’n’+’ ‘+’t’+’h’+’e’+’ ‘+’l’+’i’+’n’+’k’);
    // ]]></script>

    Is that the problem?

    Thread Starter ChangeAgent

    (@changeagent)

    The snippet works for me. I have checked your javascript line with Lint and its fine. The “// <![CDATA]” bit added by WordPress is interpreted as a comment by javascript so it is ignored. WordPress puts it in to ensure the javascript is not interpreted as html markup, which is good.

    If you can try it in Chrome, and it still doesn’t work, press control-shift-J to bring up the console. Javascript errors are highlighted. Other browsers have similar tools.

    Thread Starter ChangeAgent

    (@changeagent)

    Thanks loro, sorry for the delay, I am on the road and wanted to test a bit more. Thanks for the Lint link, very helpful!

    Let me explain what happens.

    [ Moderator note: Code fixed, please wrap code in backticks or use the code button. ]

    Code generated:

    <script>document.write('T'+'e'+'x'+'t'+' '+'i'+'n'+' '+'t'+'h'+'e'+' '+'l'+'i'+'n'+'k');</script>

    once paste as described:

    <script>// <![CDATA[
    document.write('T'+'e'+'x'+'t'+' '+'i'+'n'+' '+'t'+'h'+'e'+' '+'l'+'i'+'n'+'k');
    // ]]></script>

    What i see in the ‘Visual’ window of WP in admin:
    blank, nothing, empty space.

    What I see in a browser when I go to the site where I pasted it (tested several browsers):

    < a href="mailto:youremail@yourprovider.com?subject=Email%20subject%20(optional)">Text in the link< /a>

    what I see when I inspect in browser:

    <script>document.write('< '+'a'+' '+'h'+'r'+'e'+'f'+'='+'"'+'&'+'#'+'1'+'0'+'9'+';'+'&'+'#'+'9'+'7'+';'+'&'+'#'+'1'+'0'+'5'+';'+'&'+'#'+'1'+'0'+'8'+';'+'&'+'#'+'1'+'1'+'6'+';'+'&'+'#'+'1'+'1'+'1'+';'+'&'+'#'+'5'+'8'+';'+'&'+'#'+'1'+'2'+'1'+';'+'&'+'#'+'1'+'1'+'1'+';'+'&'+'#'+'1'+'1'+'7'+';'+'&'+'#'+'1'+'1'+'4'+';'+'&'+'#'+'1'+'0'+'1'+';'+'&'+'#'+'1'+'0'+'9'+';'+'&'+'#'+'9'+'7'+';'+'&'+'#'+'1'+'0'+'5'+';'+'&'+'#'+'1'+'0'+'8'+';'+'&'+'#'+'6'+'4'+';'+'&'+'#'+'1'+'2'+'1'+';'+'&'+'#'+'1'+'1'+'1'+';'+'&'+'#'+'1'+'1'+'7'+';'+'&'+'#'+'1'+'1'+'4'+';'+'&'+'#'+'1'+'1'+'2'+';'+'&'+'#'+'1'+'1'+'4'+';'+'&'+'#'+'1'+'1'+'1'+';'+'&'+'#'+'1'+'1'+'8'+';'+'&'+'#'+'1'+'0'+'5'+';'+'&'+'#'+'1'+'0'+'0'+';'+'&'+'#'+'1'+'0'+'1'+';'+'&'+'#'+'1'+'1'+'4'+';'+'&'+'#'+'4'+'6'+';'+'&'+'#'+'9'+'9'+';'+'&'+'#'+'1'+'1'+'1'+';'+'&'+'#'+'1'+'0'+'9'+';'+'?'+'s'+'u'+'b'+'j'+'e'+'c'+'t'+'='+'E'+'m'+'a'+'i'+'l'+'%'+'2'+'0'+'s'+'u'+'b'+'j'+'e'+'c'+'t'+'%'+'2'+'0'+'('+'o'+'p'+'t'+'i'+'o'+'n'+'a'+'l'+')'+'"'+'>'+'T'+'e'+'x'+'t'+' '+'i'+'n'+' '+'t'+'h'+'e'+' '+'l'+'i'+'n'+'k'+'< '+'/'+'a'+'>');</script>< a href="mailto:youremail@yourprovider.com?subject=Email%20subject%20(optional)">Text in the link< /a></p>

    Something is not working the way it should. any ideas?

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Javascript code not working, can you help?’ is closed to new replies.