- From: Foteos Macrides <MACRIDES@sci.wfbr.edu>
- Date: Mon, 22 Apr 1996 08:51:40 -0500 (EST)
- To: andreas@wni.co.jp
- Cc: www-html@w3.org
andreas@wni.co.jp wrote: >i found the tag > ><SCRIPT> ><!-- // --> <h1>Your browser does not support <a >href="http://home.netscape.com/comprod/products/navigator/version_2.0/script >/script_info/">JavaScript</a>, sorry</h1>. ><!-- // -->The conversion table below will not work with your browser<p><hr> > > >in the <head> tag. it seems that this tag can contain text which is >displayed only if the client's browser is anything else than >=netscape >2.0... > >on the other side it looks like a simple comment.... > >however i could not find any documentation anywhere. > >would appreciate any advice. Take a look at: HTML3 Scripting W3C Working Draft 08-Feb-96 This version: http://www.w3.org/pub/WWW/TR/WD-script-960208.html Latest version: http://www.w3.org/pub/WWW/TR/WD-script.html Editor: Dave Raggett <dsr@w3.org> Based on an initial draft by Charlie Kindel, and in turn derived from the Netscape extensions for JavaScript Authors: this will be added to as we evolve the draft --- rough draft --- --- rough draft --- --- rough draft ------ rough [...] The suggestion to use commenting to hide the SCRIPT code from SCRIPTnorant clients is "not unreasonable" if it were augmented with clear caveats. For pre-2.0 Netscape clients and clients based on CERN libwww SGML.c parsing, you have "historical" comment parsing, which is a euphamism for "no concept of a comment". The "<!--" or, in fact, "<!anything" creates an "unknown tag" situation, so that it, and everyting up to the next '>' is ignored. All you have to do for those clients is make sure no '>' appears in the script itself. For example, where you might have used "a > b" use "b < a" so that the '>' in the "-->" is the only one before the </SCRIPT>. For SCRIPTnorant clients which do support comment parsing, you in theory should simply need to avoid use of "--" in favor of other code for decrementing a variable, so that the "--" is not misinterpreted as a comment delimiter, instead of the one at the end that is followed by '>' with nothing or only white space interposed. The problem, though, is ignorance about valid comment parsing on the part of some user agent developers, and too many document providers who use Netscape as a "validator" of their markup. Note the use of "---" between the "rough draft" alerts above, which are OK there because they are not in a comment element. Many of the example scripts at Netscape, and many documents "guided" by those example, do include "decorative" dashes within the comment element for "hiding" SCRIPT content, messing up other clients which VALIDLY treat dash pairs in a comment block as delimitors, not decorations. The 08-Feb-96 draft also suggests use of use an SGML marked section to hide the script statements: <SCRIPT LANGUAGE="JavaScript"> <![ %if-script [ function square(i) { document.write("The call passed ", i ," to the function.","<BR>") return i * i } document.write("The function returned ",square(5),".") ]]> </SCRIPT> which is theoretically correct, but for a large number of clients in the present real world creates a situation like that for "historical" comment parsing. The "<![" will be treated as an unknown tag, and occurrences of '>' in the script could end the hiding, instead of it continuing to the '>' in "]]>". Fote ========================================================================= Foteos Macrides Worcester Foundation for Biomedical Research MACRIDES@SCI.WFBR.EDU 222 Maple Avenue, Shrewsbury, MA 01545 =========================================================================
Received on Monday, 22 April 1996 08:51:46 UTC