PDA

View Full Version : Email riddler invalid HTML transitional?



robertsaunders
01-14-2007, 09:26 PM
I use the email riddler from dynamic drive to encrypt email addresses on websites but now I've found from the W3C markup validity service (http://validator.w3.org) that the code makes my page http://www.vweekender.co.uk/contact.htm not not Valid HTML 4.01 Transitional. See: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.vweekender.co.uk%2Fcontact.htm&charset=%28detect+automatically%29&doctype=Inline

How can I correct this?

Rob

Twey
01-14-2007, 10:04 PM
Escape the slash in the </a> with a backslash:
<\/a>However, a) this script is horrible, and stops people without Javascript-enabled browsers from sending you emails, and b) the transitional period has been over for a long time, and you should be using HTML 4.01 Strict:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

jscheuer1
01-14-2007, 10:28 PM
Here's a tool that does about the same thing but, will allow folks without javascript enabled to email you:

http://home.comcast.net/~ansiguy/emailen1.htm

Unfortunately, I have yet to find a method of encrypting email addresses that works with anything other than the maito: href which, has its problems. It requires that the user have a properly configured email client and many folks don't.

Oh, and Twey, transitional is still the DOCTYPE of choice here and many other places, regardless of what you or anyone else might prefer to be the case.

To Both:

Escaping a / in a closing HTML tag in a string in a javascript is really somewhat silly and makes no difference to anything whatsoever except the W3c validator - perhaps other validators too. It isn't invalid HTML, it isn't even HTML. Not doing it will get you into trouble with the script interpreter in a few specific instances but, obviously this is not one of those.

That said, I often escape them just to shut up the damn (can I say damn?) validator. :)

Twey
01-14-2007, 10:47 PM
Unfortunately, I have yet to find a method of encrypting email addresses that works with anything other than the maito: href which, has its problems. It requires that the user have a properly configured email client and many folks don't.Thus, a server-processed form is really the best option.
Oh, and Twey, transitional is still the DOCTYPE of choice here and many other places, regardless of what you or anyone else might prefer to be the case.But there's no reason this should be the case. It's not really a DOCTYPE of choice, more the DOCTYPE selected by default by someone who doesn't know better. Occasionally people do use it in order to use, say, frames, but this is generally a sign of a poor design (or a magpie-like fixation on what's perceived to be smoother) rather than any real need to use frames.
Escaping a / in a closing HTML tag in a string in a javascript is really somewhat silly and makes no difference to anything whatsoever except the W3c validator - perhaps other validators too. It isn't invalid HTML, it isn't even HTML. Not doing it will get you into trouble with the script interpreter in a few specific instances but, obviously this is not one of those.Yes, putting the script is an external file is the preferable solution, and I do this on all new pages. However, there's really no serious problem with tags inside script elements, since, if I recall correctly, the contents of a script tag is defined as CDATA, so the tags (other than </script>) shouldn't have any special meaning, and I do it with existing pages occasionally just, as you say, to shut the validator up. I must wonder exactly why it is that the validator throws an error here though.

robertsaunders
01-15-2007, 03:19 PM
Thanks to both of you for your replies.

Rob