Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Interesting but ultimately useless

Via Stuart, Tantek has an intriguing new (valid) hack for adding HTML documentation to an external javascript file. The hack uses some clever multi-language comments to hide the HTML in the file from the script interpreter, while ensuring that the documentation remains readable when the file is interpreted as HTML. Unfortunately the trick does not work in Mozilla, as that browser respects the Content-Type served with the document (whereas IE “guesses” the content is HTML from clues in the document).

This is Interesting but ultimately useless by Simon Willison, posted on 22nd November 2002.

View blog reactions

Next: Aquari-gone-ics

Previous: Mark's tinkerings

3 comments

  1. Actually, IE6/XP shows a "Save As" dialog box as well. So does Netscape 4.x. Quite rightfully so, I'd say. The Content-Type is text/* - why not text/javascript? (Even then I doubt correct browsers would show the HTML).

    Oh, it /does/ work in Opera 6.

    (Unrelated - Simon: oculd you add <label /> elements for the Yes/No cookie option? You've got a silly label for "Remeber details" now.)

    Jan! - 23rd November 2002 14:04 - #

  2. Whoops, that should be: it shows the document as plain text in Opera instead of opening the "Save As" dialog. No HTML there.

    Jan! - 23rd November 2002 14:07 - #

  3. Fixed the label issue - thanks for reminding me.

    Simon Willison - 23rd November 2002 20:01 - #

Comments are closed.

Previously hosted at http://simon.incutio.com/archive/2002/11/22/interestingButUltimatelyUseles

A django site