Problems with my obscured-email javascript in Mozilla

T

trevors_decoy

Hi,

apologies if this sort of query pops up all the time - I did spend a
while searching the archives first...

My website tries to protect my email address from the spam harvesters
by obscuring it. Works like a dream under IE 5&6, fails under Mozilla.
I just put the script inline where I want a mailto href.
Under Mozilla the fake_email_address@fake_domain.com isn't replaced by
the real deal - both in the href and on the status bar. That suggests
my onclick/MouseOverare being ignored.
(The page in the <noscript> href just displays a message that you you
need to enable javascript.)

Any clues appreciated.


<script type="text/javascript">
<!--
function obfuscate_email()
{
email_start = unescape('%6D')+"ailto"+unescape('%3A')+"trev"
email_end = "oneensemble"+unescape('%2E')+"com";
email_middle = "or"+unescape('%40')+"cl";
return email_start + email_middle + email_end;
}
document.write('<a href="mailto:fake_email_address@fake_domain.com"')
document.write(' onclick="this.href=obfuscate_email();"')
document.write(' onMouseOver="window.status=obfuscate_email();return
true;"')
document.write(' onmouseout="window.status=\'\';return true;">')
document.write(' <img border="0" src="folder_bottom.gif" align="top"
width="32" height="20">')
document.write(' Contact us')
document.write('</a>')
//-->
</script>
<noscript>
<a href="cl_noscript.htm">
<img border="0" src="folder_bottom.gif" align="top" width="32"
height="20">
Contact
</a>
</noscript>
 
R

Randy Webb

(e-mail address removed) said the following on 6/26/2006 8:26 AM:
Hi,

apologies if this sort of query pops up all the time - I did spend a
while searching the archives first...

Did you find the many threads on the problems with mailto: ? Your link
doesn't work for me at all and not because of the script but because
mailto: doesn't work for me.
My website tries to protect my email address from the spam harvesters
by obscuring it. Works like a dream under IE 5&6, fails under Mozilla.

Not for me it doesn't, it changes the href as you wanted.
I just put the script inline where I want a mailto href.

Use a form, server side processing, and all is fine, no need to try to
hide an email address.
Under Mozilla the fake_email_address@fake_domain.com isn't replaced by
the real deal - both in the href and on the status bar. That suggests
my onclick/MouseOverare being ignored.

It works for me, what version Mozilla? And, what messages are in the JS
Console?
(The page in the <noscript> href just displays a message that you you
need to enable javascript.)

Search the archives for the problems with the noscript element.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,187
Members
46,730
Latest member
AudryNolan

Latest Threads

Top