Welcome to WebmasterWorld Guest from 54.144.107.83

Forum Moderators: incrediBILL

Message Too Old, No Replies

Spam-protected email address script not working in Firefox

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

New User

10+ Year Member

joined:July 4, 2003
posts:36
votes: 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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 30, 2004
posts:712
votes: 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)

New User

10+ Year Member

joined:Jan 25, 2006
posts:22
votes: 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>");
//-->
</script>

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

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9063
votes: 2


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)

New User

10+ Year Member

joined:July 4, 2003
posts:36
votes: 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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 31, 2005
posts:1108
votes: 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)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9063
votes: 2


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)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 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)

New User

10+ Year Member

joined:July 4, 2003
posts:36
votes: 0


Thanks

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!

Cheers

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 30, 2004
posts:712
votes: 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)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


Note: Javascript oriented discussion is continued here:

[webmasterworld.com...]