Forum Moderators: mack
hideurl.js
function hide(theText) {
var newText = "", n = null;
for (n=0; n < theText.length; ++n) {
newText += theText.charAt(n) + "_";
}
newText = newText.replace(/@/g, "`");
return newText;
}
function unhide(theText) {
theText = theText.replace(/_/g, "");
theText = theText.replace(/\`/g, "@");
theText = theText.replace(/\%60/g, "@");
return theText;
}
hider.htm
<script type="text/javascript" src="hideurl.js"></script>
...
<div>
<input id="txt" type="text" value="" style="display: inline; width: 30%;"/>
<input type="button" value="Code" onclick="document.getElementById('txt').value = hide(document.getElementById('txt').value);"/>
<input type="button" value="Decode" onclick="document.getElementById('txt').value = unhide(document.getElementById('txt').value);"/>
</div>
testfile.htm
<script type="text/javascript" src="hideurl.js"></script>
...
<div>
<a href="mailto:d_o_w_n_i_n_`_f_r_a_g_g_l_e_._r_o_c_" onclick="this.href=unhide(this.href); return true;" onmouseover="window.status=' '; return true;" onmouseout="window.status='';">Cammo. Link</a>
<a href="http://w_w_w_._w_e_b_m_a_s_t_e_r_w_o_r_l_d_._c_o_m_/_" onclick="this.href=unhide(this.href); return true;" onmouseover="window.status=unhide(this.href); return true;" onmouseout="window.status='';">Cammo. Link</a>
</div>
Jordan
So using the hider.htm page, you hide the address, then use that output in your link (see testfile.htm); then with the onclick, onmouseover and onmouseout attributes on the link, you use the unhide function to get the original address back and show it in the status bar or else navigate to it when clicked.
Jordan
function nospam( domain, garbage, user, text ) {
var ToReturn = '';
if ( domain != '' ) {
var HateSpam = user + '@' + domain;
ToReturn = '<a href="mailto:' + HateSpam + '">';
if ( text == undefined ) {
ToReturn = ToReturn + HateSpam;
} else {
ToReturn = ToReturn + text;
}
ToReturn = ToReturn + '</a>';
}
return ToReturn;
} I saved it in external file so I can reuse it on different pages. I call it in the header of the page. Then in the body I put the following:
<script type="text/javascript" language="javascript">document.write( nospam('domain.com','batman98','user_id') )</script><noscript>user At domain.com</noscript> If you want a different anchor text than your email, then just pass another (4th) argument to the function with your custom text.
I also use random field (just in case), there you can write anything you want, it will not affect anything. Just so that "smart" bots get confused there.
Until I get around to js, would my solution work for a large percentage of spiders, or is it a waste of my time? This is for an inline translator, to grab and hide e-mail addresses.
Amgine
To see what I mean enter this in your URL bar:
javascript: alert(decodeURIComponent("%49%20%53%65%65%20%59%6f%75"));
;)
Jordan
Another solution, but won't work for my situation (hmm... actually, uhm...) suggested on alt.php - [rsscripts.tripod.com...] Basically, put e-mail addies into form. Which, I 'spose, I could do inline... uglification... unless I build a jpeg button onfly...
Do you stream of conscious when tired too? gnite.
Amgine
The larger the variety of options, the harder harvesters have to work. The more esoteric the option, the fewer harvesters will be looking for it. Contrariwise, if everyone switches over to one other way of cloaking e-mail, the harvesters will be looking for that.
Amgine
You are merely assigning the attribute to an img tag. So the mailto:me@mydomain.com remains in the source code.
Oh, and Welcome to WebmasterWorldrld [webmasterworld.com] :)
Ta
Limbo
Maybe it's not worth the trouble for most email harvesters to cope with encoding - after all they don't need every email address in the world. Probably more worthwhile to improve the reach of the pages they harvest from.
is there problems if you make it into a graphic?
You are merely assigning the attribute to an img tag.
Actually, I think the original poster was thinking of something like the access codes used on the netsol Whois database, which would allow you to put an email address up that would be 100% safe from harvesters, but it could not have a clickable link. So a human reader could read it and type it into an email client, but it couldn't be a link, because then the harvester would snag it from the href.
<script language="JavaScript">
<!--
// hide script
var sb_domain = "WEBMASTERWORLD.COM"
var sb_user = "KENN"
var sb_recipient = sb_user + "@" + sb_domain
var sb_url = "mailto:" + sb_recipient
document.write(sb_recipient.link(sb_url));
// --></script>
So thanks Moltar - and everyone lese - and I hope I'm not tempting fate by this post!