homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Browsers / Firefox Browser Usage and Support
Forum Library, Charter, Moderators: incrediBILL

Firefox Browser Usage and Support Forum

Spam-protected email address script not working in Firefox

 1:17 pm on Jan 26, 2006 (gmt 0)

For quite some time I have been using a bulletproof anti spam email address protection system. It no longer works in the recent version of Firefox:

It works like this:
In the page code there is a reference to an external js file:

<script type="text/javascript" language="JavaScript" src="hidem.js"></script>

The hidem.js file reads as follows:

<!-- Begin
userpart1 = "te";
userpart2 = "st";
sitepart1 = "dom";
sitepart2 = "ain.com";
document.write('<a h' + 'ref="m' + 'ailt' + 'o:' + userpart1 + userpart2 + '@' + sitepart1 + sitepart2 + '\">');
document.write('<img style="position:relative; top:3px" src="image-of-email-address.gif" border="0" height="15" width="165" alt="spam-protected clickable email address">' + '</a>');

// End -->

As you can see the code breaks up the email address into segements and displays an image of the email address. Pretty bulletproof, but also Firefox proof now! :-(

Any help appreciated. Thanks



 1:55 pm on Jan 26, 2006 (gmt 0)

I believe there is no need to escape the double quote at the end of the first line: '\">');


 2:37 pm on Jan 26, 2006 (gmt 0)

I may be wrong but doesnt this achieve the same effect?

<script type="text/javascript">
var username = "enquiries";
var hostname = "yoursite.co.uk";
var linktext = username + "@" + hostname;
document.write("<a href=" + "mail" + "to:" + username + "@" + hostname + " title=" + linktext + ">" + linktext + "</a>");


 3:36 pm on Jan 26, 2006 (gmt 0)

When you say the script is not working, what is happening exactly? Is it not displaying at all or visible just not functioning?


 8:55 pm on Jan 26, 2006 (gmt 0)

Thanks. Removing the escape character did not seem to do anything. Havent tried the alternative script yet, but will do so later. The problem is that in Firefox nothing whatsoever is showing.


 12:29 am on Jan 27, 2006 (gmt 0)

Well I have a piece of JavaScript on my site that does essentially the same thing, except I didn't bother doing a document write of the image, but just wrote out the e-mail address for the link. I only only put an image in the noscript tags.
It works fine in both IE and FireFox.


 1:51 am on Jan 27, 2006 (gmt 0)

The script you gave works perfectly on a test page in Firefox too, so the problem is not directly with the script but elsewhere. Does the Javascript console in FF give any errors? Are you doing any sort of mime-type switching for XHTML?


 5:55 pm on Jan 28, 2006 (gmt 0)

Same here - I tested it with the code IN the document then with it external, works both ways. Put an alert in your JS to make sure it's correctly linked?


 7:54 pm on Jan 29, 2006 (gmt 0)


Sorry what had happened is I had mistakenly switched Javascript off in my version of Firefox! (via the web developer tools plugin)

Anyway hope someone finds the script useful for themselves.
Not sure whether it is necessary to go so far as to display an image of the email address instead of text, but I do that anyway for ultimate bullet-proofing!



 8:20 pm on Jan 29, 2006 (gmt 0)

I was thinking, there is a reason that CAPTCHA images are really hard to read sometimes. And the only reason I can come up with is that there must be bots out there that use OCR (Optical Character Recognition).
So I guess if we want bullet-proof email addresses we have to write them down on a piece of cigarette paper and eat them.


 8:51 pm on Feb 3, 2006 (gmt 0)

Note: Javascript oriented discussion is continued here:


Global Options:
 top home search open messages active posts  

Home / Forums Index / Browsers / Firefox Browser Usage and Support
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved