<limittext value="MSN-TV JS Bug – Please Reload">

Email Script Demo

INTRODUCTION


This is a demo of an email link on a webpage that is invisible to web-spiders that search the internet for email addresses on webpages.

The email addy below is invisible to spiders because it uses javascript to write the email addy. The script assigns variables to each part of the email addy and uses javascript "document.write" statements to construct the addy and display the email addy on the webpage.

Email harvesting web-spiders do not have javascript because they are programmed to search for the familiar email addy in text format within the wepage embeded code.

 

DEMO SCRIPT


Click the email link below. It should work with your browser by filling in the "From:" and "To:" fields of your email program. It even works with AOL because the email addy is written within an HTML "<a>" tag with a "mailto:" href attribute as AOL browsers have always required.



Here's the script for the above email link:

<div align="center"><script language="javascript"> function contactMe() {var type="mailto:"; var who="jaxred"; var at="@"; var where="webtv"; domain=".net"; document.write('<a href="'+type+who+at+where+domain+'">'); document.write('Contact Me'); document.write('</a>');} contactMe();</script> </div></plaintext><br> <br> Note that this script is a function that can be added to an HTML document head tag or placed anywhere on a webpage. Here I called the script from within the script, using the function call operator, like this: "contactMe();" before the closing script tag. You can also write the script without the function call – ie; without the "contactMe();" statement – in the head tag of your document, or at the top of your document, and call the function anywhere on the webpage with the following code:<br> <br> <plaintext> <div align="center"> <script language="javascript"> contactMe(); </script> </div> </plaintext><br> <br> Note: If you desire to write scripts in a PageBuilder head tag, you must use a PageBuilder Advanced Editor Method to extend the head tag to an "Add text" box so you can add your script inside the extended head tag. However, as noted above, you can write this script anywhere on your webpage; just be sure you define the function before you "call" it in your webpage. If you do not want to use a function, follow the format of the simple script shown below.<br> <br> When you use scripts in an MSN-TV PageBuilder webpage, especially cut-and-paste scripts from the internet, you must type the scripts without returns or comment tags to hide the script from non-javascript browsers – use single spacing between script text, allowing your typing to auto-return each line. Every time you use the return-key in pageBuilder, the PageBuilder program adds a "&lt;br&gt;" tag which kills the scripts. Also, comment tags inside the script tags in a PageBuilder "Add text" box hide the scripts on the webpage. Because the webpage is essentially an HTML table formatted template document, the comment tags hides all text between comment tags and prevents the script from being actively embeded in the webpage, although the code is visible in the webpage source code.<br> <br> Warning: Take particular note of how I use both single and double-quotes in the above script. Some of the latest browsers require use of the strict syntax of XHTML which requires double-quotes around the "mailto:" value of the "href" attribute of the "&lt;a&gt;" tag. Therefore, I used single-quotes around the document.write statement with nested double-quotes around the "href" attribute value. Also note how the quotes surround only the literal text that is to be written, and do not enclose any variables, because the variable values are quoted when they are defined in the "var" statements and do not need additional quotes in the document.write statement. Understanding how to use quotes in the document.write statements is the key to understanding how to make these scripts work properly.<br> <br> I could have used either all single or all double-quotes in the document.write statement; but, I would have to use back-slashes (\' or \") to escape all the inner set of quotes. This is easy enough, except for the quirky way PageBuilder handles the use of back-slashes to escape quotes in scripts. Each time you open a document with scripts containing back-slashes; the back-slashes disappear, which requires that you go thru the document and replace the missing back-slashes each time you edit the text box containing the escaped scripts. I avoid this problem by using the nested single and double-quotes.<br> <h3> <font color="#ffd700">A SIMPLER SCRIPT</font></h3><br> The above script concatenates the parts of the email addy in the "document.write" statement with the "plus" (+) operator; which, with the necessary quotes, as noted above, makes a rather long and difficult statement to write. The script can be simplified by using the "plus-equal" (+=) operator to concatenate the parts of the email addy as the addy variables are defined. This will allow a simpler script using a single concatenated variable in the document.write statement. You still have to be sure the &lt;a&gt; tag's href mailto: value is properly enclosed within double-quotes inside the single-quotes of the document.write argument, as explained above. Click the email link below to see it work:<br> <br> <div align="center"> <script language="javascript"> var addy="YourUserName"; var addy += "@"; var addy += "webtv"; var addy += ".net"; document.write('<a href="mailto:' +addy+ '">Email Me</a>'); </script> </div><br> <br> Here's the code for this simple script:<br> <br> <plaintext> <script language="javascript"> var addy="YourUserName"; var addy += "@"; var addy += "webtv"; var addy += ".net"; document.write('<a href="mailto:' +addy+ '">Email Me</a>'); </script> </plaintext><br> <br> Thanks to our MSN® TV scripting expert Bob, aka <a href="mailto:RWEDGE@webtv.net">RWEDGE@webtv.net</a>, for the reminder about the use of the "+=" operator! Bob suggested the use of the "+=" operator, in the manner suggested above, in response to my posting of email scripts in the <a href="news:alt.discuss.javascript">JavaScript NG</a>. Visit the Javascript NG for answers to all your scripting problems and to assist others with scripts if you can.<br> <br> Note: The above script is not a function, but a simple "document.write" statement that must be placed where you want the email link to appear in your document. As explained above, you can write the above script as a function in the head tag or near the top of your document, and call it anywhere you want inside the body of the document. It's easier to use a single function if you need to display (call) your email link multiple times in your document. <br> <br> Modify and practice with the above scripts any way you like. Practice by changing the name of the function and variable names. Split the addy into different groups of words to disguise it so it doesn't appear as an email addy to web-robots. There are many similar scripts on the internet – search the many free, online script sources.<br> <h3> <font color="#ffd700"> <u>CUT-AND-PASTE SCRIPTS</u> </font> </h3><br> Click the link below to check out the simple script below – it's a good, simple script that was just added to <a href="http://www.javascripts.com">http://www.javascripts.com</a>; and which shows "nested" double-quotes and the use of the "escaped" double-quotes" between the enclosing outside double-quotes as I explained above:<br> <br> <center> <!-- Code By: Agony --> <script language="javascript"> var name = "Yourname@"; document.write ("<a href=\"mailto:" + name + "YourEnd.Com\">Mail to me</a>"); </script> </center><br> <br> Here's the code for this simple script showing how to "escape" the "nested" double-quotes. Note how the "nested" double-quotes between the enclosing double quotes are "escaped" and the variable names are not enclosed in quotes.<br> <br> <plaintext> <!-- Code By: Agony --> <script language="javascript"> var name = "Yourname@"; document.write ("<a href=\"mailto:" + name + "YourEnd.Com\">Mail to me</a>"); </script> </plaintext><br> <br> Note that this script is not a function that has to be "called", but is a simple script written where it is desired to appear in the webpage.<br> <br> This script is at: <a href="http://webdeveloper.earthweb.com/webjs/item/0,3602,12744_62741,00.html">http://webdeveloper.earthweb.com/webjs/item/0,3602,12744_62741,00.html</a>. Click the links to "See it run" and to "See the code" at the bottom of the above webpage.<br> <br> Another script, at: <a href="http://www.netmechanic.com/news/vol4/design_no21.htm">http://www.netmechanic.com/news/vol4/design_no21.htm</a>, shows a simple script without the nested quotes problems noted above. Click the email link below to see it work and check out the code below:<br> <br> <p align="center"> <script language="javascript"> var contact="Email Me"; var email="jaxred"; var emailHost="webtv.net"; document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost + ">" + contact + "</a>"); </script></p><br> Here's the code for this script:<br> <br> <plaintext> <p align="center"> <script language="javascript"> var contact="Email Me"; var email="jaxred"; var emailHost="webtv.net"; document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost + ">" + contact + "</a>"); </script> </p> </plaintext><br> <br> This is an easier script to write for beginners due to the use of simple double quotes we all use for our HTML code attribute values. The complexities of using escaped and nested quotes explained above are eliminated. Note that in the "document.write" statement only the literal words are enclosed in quotes while the variable names are used without quotes. The words and variable names are concatenated using the "plus" (+) operator. See how the word "mailto:" is split into two words to further hide the script from spiders. I also suggest splitting the variable "emailHost" into two variables, like this: host="webtv"; domain=".net"; would further conceal this script as an email addy.<br> <br> <h3> <font color="#ffd700"> <u>OTHER METHODS TO HIDE EMAIL ADDYS</u> </font> </h3><br> Here's a far simpler way to show your email addy on your webpage without writing it out in the standard format that web-bots will recognize. Just write a statement that will not be an email hyperlink; but, will tell your webpage viewers how to address an email to you. As an example, say: "If you have any comments on this subject, email me, JaxRed, at webtv.net". There are many creative ways to show your webpage viewers how to write your email addy without revealing it to robots.<br> <br> The oldest known way to conceal your real email addy is to deliberately write a false email addy and tell your viewers how to modify the addy to your real email addy. You can add some numbers and/or letters to your username and then tell your viewers to remove the incorrect part of the addy, or leave out part of your user name and tell your viewers to add the missing part. As an example, say: "Contact me at: <a href="mailto:JaxRed0711@webtv.net">JaxRed0711@webtv.net</a> (Note: Robot-free addy here – Please remove the "0711" after my username for my real email addy)".<br> <br> I'm sure you've seen these examples many times before. It's kinda cruel, but justifiable payback, to the email harvesting web-robots bcause it feeds them an erroneous email addy that bounces back to the spammers. However, you need to be sure that the false email addy you use is not some other person's email addy. Bounce your bogus emal addy to be sure it's not being used by someone else before you use it on your webpage.<br> <br> <br> <h3> <font color="#ffd700"> <u>CHECK OUT KEN"S SCRIPT</u> </font> </h3><br> My friend Ken, aka <a href="mailto:kdine@webtv.net">kdine@webtv.net</a>, has other methods using alternate characters and a script for hiding email addys from web-spiders on his webpage at:<br> <br> <a href="http://community-2.webtv.net/kdine/spiders/">http://community-2.webtv.net/kdine/spiders/</a><br> <br> Here's a script from Ken's page. Click the link below to see the script work:<br> <br> <center> <script language="javascript"> var showlink="E-Mail Me"; var showname="YourUserName"; var showhost="webtv.net"; document.write('<a href="'+'mail'+'to:'+showname+'@'+showhost+'"'+'>'+showlink+'</a>'); </script> </center><br> <br> Here's the code for Ken's script:<br> <br> <plaintext> <script language="javascript"> var showlink="E-Mail Me"; var showname="YourUserName"; var showhost="webtv.net"; document.write('<a href="'+'mail'+'to:'+showname+'@'+showhost+'"'+'>' +showlink+'</a>'); </script> </plaintext><br> <br> Check out Ken's tutorial and send him additional info and scripts you think he may want to include in his tutorial.<br> <hr> </TD></TR></TABLE> </p> <p>&nbsp;</p> <p> <TABLE> <TR><TD> <H3 ALIGN=left> <font color="#ffd700"><u>VIEW THE SOURCE CODE OF THIS WEBPAGE</u></font> </H3> <P ALIGN=left> <div align="center"> <form method="post" action="http://www.thunderstone.com/texis/demos/dox?demo=http://community-2.webtv.net/jaxred/email/">View the <input type="submit" name="demo" value="Source Code" onClick="form.submit()"> of this webpage with the Thunderstone WebTV Source Code Viewer. Put a "Source Code" <a href="http://community-2.webtv.net/jaxred/Viewers/">Viewer</a> on your webpages.</form></div> </TD></TR></TABLE> </p> <table border="0" cellpadding="0" cellspacing="2" width="100%"> <tr height=0> <td height=0> <spacer type=block width=30% height=0> <td height=0> <spacer type=block width=30% height=0> <td height=0> <spacer type=block width=30% height=0> </tr> <tr> <td colspan="3"> <hr> </td> </tr> <tr> <td valign=middle width=30%> <font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"> <b> </b></font></td> <td valign=middle width=30%> <center> <font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size=-2><I> <a href="http://www.msntv.com">Powered by MSN TV</a> </I></font></center> </td> <td align=right valign=middle width=30%> <font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"> <b> </b></font></td> </td> </tr> <tr> <td colspan="3"> <hr> </td> </tr> </table> </BODY> </HTML>