HTML and CSS validation request source file identification.

My web design teacher gave me the following code to paste into my HTML
pages to request validation:
<a href="http://validator.w3.org/check/referer">Valid HTML</a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">Valid CSS</a>
This only works if I disable a feature of my firewall that prevents sites
from inspecting my browsing history.
You provided the following alternative code:
<a href="http://validator.w3.org/check?uri=theURLofMyFile>...
<a
href="http://jigsaw.w3.org/css-validator/validator?uri=theURLofMyFile>...
The problem with this is that I have to embed the full URL of my file,
which may move around, and I can't use this code as boilerplate or a link
include.
I proposed the following JavaScript solution:
<a id="aValidHtml" href="http://validator.w3.org/check/referer">Valid
HTML</a>
<a id="aValidCss"
href="http://jigsaw.w3.org/css-validator/check/referer">Valid CSS</a>
<script type="text/javascript">
document.getElementById( "aValidHtml" ).href=
"http://validator.w3.org/check?uri=" + document.URL
document.getElementById( "aValidCss" ).href=
"http://jigsaw.w3.org/css-validator/validator?uri=" + document.URL
</script>
My teacher objects that this assumes that the browser can and will
execute the script. I disagree. If the script is not executed at all, the
original code, which depends on the firewall not blocking history,
remains intact. If the script is executed properly, the anchors' hrefs
are changed to the explicit source syntax with the current URL of the
file. There will only be a problem if the browser executes the script
incorrectly. It seems to me that something as fundamental as the URL of
the file is likely to be the same thing under all browsers (I have
verified this for IE6.0 under ME and Mozilla and Konqueror under Linux)
and unlikely to be deprecated in the future. The HTML and CSS validators
have no trouble with requests from my code (with the script having
replaced the hrefs).. Have I overlooked potential problems? Is there a
better way to do this?

Received on Monday, 27 September 2004 15:18:47 UTC