Welcome to WebmasterWorld Guest from 54.163.35.238

Forum Moderators: incrediBILL

Message Too Old, No Replies

Spam-protected email address script not working in Firefox

     

albroun

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

10+ Year Member



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

Span

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

WebmasterWorld Senior Member 10+ Year Member



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

WillisTi

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

5+ Year Member



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>

encyclo

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

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



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

albroun

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

10+ Year Member



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.

Dijkgraaf

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

WebmasterWorld Senior Member 10+ Year Member



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.

encyclo

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

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



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?

rocknbil

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

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



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?

albroun

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

10+ Year Member



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

Span

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

WebmasterWorld Senior Member 10+ Year Member



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.

tedster

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

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



Note: Javascript oriented discussion is continued here:

[webmasterworld.com...]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month