By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,602 Members | 1,533 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,602 IT Pros & Developers. It's quick & easy.

Problems with my obscured-email javascript in Mozilla

P: n/a
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();retur n
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>

Jun 26 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
tr***********@hotmail.com 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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.