View Full Version : I.E. Messing my simple script's day up!

Tristan Gray
04-22-2008, 02:36 AM
I am trying to use java to parse an e-mail address thus preventing bots from indexing it. I think this can be done with php as well. Am I going to have to do it with php to ensure that fools with default IE7 security settings won't get broken/missing links?

I am also using java to open new windows and IE is breaking that nicely too. Suggestions?

04-22-2008, 05:04 AM
are you using a java applet or jsp?

Also when you say that you are having java parse an email address what do you mean exactly? Someone is entering an email address and you're getting it?

Tristan Gray
04-22-2008, 03:36 PM
Instead of displaying the e-mail link in its entirety it is breaking it into sections and then concatenating it and printing on the page. This is being done to avoid web spiders harvesting the e-mails and spamming them.

04-22-2008, 06:09 PM
I am not very clear on your question....

For the latter question of opening new windows, are you doing this through Java or Javascript? I don't even think you can do that with Java, so more than likely you are doing it with Javascript. Please be specific in what you mean by "IE is breaking that nicely too". What is the code that you are using and what is the effect (i.e. error) that you get as a result.

In regards to the first question about breaking up the email address: you can do that via Javascript or Java. Assuming you are doing it in Java as you say, here is one possible way:

String email = "john.doe@foo.com";
int divIndex = email.indexOf('@');
String emailP1 = email.substring(0, divIndex);
String emailP2 = email.substring(divIndex+1);

out.write(emailP1 + " at " + emailP2);