JS runs on the client. Perl runs on the server (in this setup, anyhow). JS starts working only after Perl has done all its work generating the page to send to the browser. So, in a way, the JS folks are right.

But what you *can* do is go through a JS-enabled page which creates a link (or, perhaps, a form submit button) that adds the JS-only info via GET or POST to the server. Alternately, use JS to set a cookie on the passthru page and have your Perl scripts read the cookie. Subsequent Perl-generated pages can act on this information.

Limitation: need for a passthru page, and if the user resizes her browser after the information is passed, she'll be stuck with your CSS-defined values.

sample code:

<script type='text/javascript'> <!-- // I don't know which property we're talking about // so this is schematic document.writeln('<input type="hidden" name="xsize" value=window.x +size>'); //blah blah // --> <input type="submit" value="Enter the Site"> </form>

HTH, although I in no way endorse your obsession with controlling presentation to this degree =)

Philosophy can be made out of anything. Or less -- Jerry A. Fodor


In reply to Re: Get info from browser known only to JavaScript? by arturo
in thread Get info from browser known only to JavaScript? by aplonis

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.