TinyMCE URL rewrite problem editing emails (kinda solved)

TinyMCE has a habit of rewriting the URL for images, etc.  However, this becomes broken when using TinyMCE to edit things like emails.  The relative path is totally useless in an email because the email is not being viewed from the server like a webpage would be.

To fix this I searched the tiny_mcs.js and found that TinyMCE had two settings in the tiny_mce.js file that are boolean flags (true,false or 0,1) dealing with URL’s. The variables are relative_urls and convert_urls, and by default they are set to true, or 1.

After changing these setting to false (or zero) I have not had any further problems with using TinyMCE to edit email content.

Hiding an email address using Javascript

Have you ever wondered why you suddenly started getting tons of spam?

Do you have, or did you recently post your email address on a website?

Then the reason is probably because you did not properly protect the email address, and spammers get most email addresses from robot script that harvest email addresses from websites. It is pretty simple really. The robot script hits the largest search engines for certain key words or phrases, to help the spammer hit the most relevent email addresses, and then systematically follows the links to websites. Once the robot gets to the website it then searches all links on the page. Each link it finds on the page that is a “mailto:” is an email address, and in a matter of minutes a robot script can harvest hundreds of emails.

So now you are asking, “What can be done to protect me from these vile robots?”. Well that answer is also simple. Most robot script are not smart enough, yet, to search Javascript code that scrambles an email address and form it back into a valid email address. So here is how to do it:

First, you need to go into the HTML code and insert the Javascript as follows:

var theuser = "username" // change this to be the username, or portion of the email to the left of the @
var thehost = "your-domain.com" // change this to be your domain name
 
var themessage = theuser + "@" + thehost;
 
// Now we tell Javascript to bring the pieces of the email address together visually on the screen as a link
document.write("<a href=" + "mail" + "to:" + theuser + "@" + thehost + ">" + themessage + "</a>")

Note: Be sure to substitute username and your-domain.com with your own information.

Now when you view your webpage in your favorite browser (Firefox) you will see the email as a link like you wanted, and the robots will see a bunch of code that most of them cannot form into a valid email address.