Greetings,

This isn't a very creative solution, but it works. (Sort of.) On the "enterance page" to your site, or where ever you want to test for JavaScript, give the user an auto-jump page just prior to their actual CGI destination.

<HTML><HEAD><TITLE>Something Interesting</TITLE> <SCRIPT language="JavaScript"><!-- document.location.href="/cgi-bin/destination.cgi?hasjs=1"; // --></SCRIPT> </HEAD> <NOSCRIPT> <Meta HTTP-EQUIV="Refresh" CONTENT="0;URL=/cgi-bin/destination.cgi?has +js=0"> </NOSCRIPT> </HTML>

Couple things bad about this. First of all, it forces the user to make an additional HTTP hop before getting to destination.cgi or where ever. The other bad thing is that the "?hasjs=" thing shows up in the URL. That annoys me.

Another idea might be to attempt to write a cookie with JavaScript when the user first gets to your site, then read that cookie with each Perl CGI. If Perl can read the cookie, then you know JavaScript was at least enabled back when you set the cookie (few seconds, couple minutes). Unfortunately, this solution relies on the user allowing the cookie, which some users still have problems with.

-Gryphon.


In reply to Re: Perl & JavaScript by gryphon
in thread Perl & JavaScript by akm2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.