Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a form that uses JavaScript for form validations. Anyway I can use Perl to check if Javascript has been disabled on the user's browser? If Javascript has been disabled I want to put out a message that it has been disabled. We have Netscape 4 and IE 5.5 browsers.

Replies are listed 'Best First'.
Re: Checking client browser
by zby (Vicar) on Apr 08, 2003 at 11:52 UTC
    You can display the message on the client side inside <NOSCRIPT></NOSCRIPT>. That's how this is done usually.

    If you insist in checking it on the server side - you can have the javascript set an hidden form field and then check on the serverside if you get it set. But it works only when you have a form in your html.

      I heard about <NOSCRIPT></NOSCRIPT> but have no idea how to use it in this situation?
        Experiment!

        What you put inside those tags is displayed only if the browser does not execute javascript.

Re: Checking client browser
by Jenda (Abbot) on Apr 08, 2003 at 12:26 UTC

    Put an

    <input type=hidden name="JSenabled" value="0">
    into the form and add
    onLoad="document.frmName.JSenabled.value=1"
    into the <BODY> tag.

    But it would be safer to recheck everything on the server side even if you think the JavaScript already validated the data.

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature