in reply to cgi.pm and noscript

Perhaps you should be explicit about what you're trying to do. What scripting language are you trying to use to which you want the noscript to apply and how are you trying to call the script?

My best guess, based on your second para, is that you have a script (js, VB, tcl or whatever) in the head section of a page generated by a perl script and that you're trying to execute the script or the content of the noscript element when the page is loaded.

Update: Off on the wrong, Wrong, WRONG! track.

The noscript tag is used to provide some sort of alternate info for browsers (intrinsicly or because of a user-selected option) which won't execute the script. But the noscript has to be in the body since it won't be executed if it's in the head section. TTBOMK (and recollection ... and sticking to js for this comment), in the case of an "onload" inside the <body...> tag, HTML provides no way to apply a <c>noscript alternate.

OTOH, if you've inserted your script in-line, it appears that noscript should work if placed immediately after the script; substitute "might" for "should" if your script is in the head or an external file (and, in either case, remember that HTML doesn't allow noscript inside a <p>...</p> construct.

IMO, §18 of the w3c guide on scripts doesn't provide a satisfactorily explicit answer to your question and the doc for CGI.pm that's distributed with 5.12 effectively tosses the question back to w3c...

But this is based on way-too-much guesswork. Tell us more.

Replies are listed 'Best First'.
Re^2: cgi.pm and noscript
by Anonymous Monk on Sep 18, 2011 at 14:45 UTC

    I was looking for an alternative to my current method which is

    $cgi->start_html( ... -script => {-language => 'javascript', -src => '../javascript/sc +ript.js'}, -onLoad => 'init()', ),

    where script.js contains

    function init() { document.getElementById('jsDisabled').style.display = 'none'; }

    which hides a message about javascript being disabled, but sometimes it briefly appears on the page, so I wondered if using the noscript tag would improve on that.