I know that you can get the size of a visitor's screen using Javascript with screen.width, but I don't know enough Javascript to know if there is a way to pass this value on to Perl some how? Or better, a way to get this value with Perl itself?

A google search didn't turn up anything Perl related and a search here only returned a way to use Term::Readkey to get the screen size of a local terminal user.

My aim isn't (at this time at least) to redirect a user based on their screen size, but rather to log this data. I somehow need to get their screen size and INSERT it into their account record in Postgresql via Perl. The only solution I've found is to use Javascript to detect their screen size, redirect them to a page based on this size, then have that page populated with pre-filled FORM data that is submitted to Perl and INSERTed. There must be a more elegant way though. Either to detect the screen size with Perl or to elegantly pass the value of the Javascript screen.width to a hidden form <input> that can be submitted to Perl.

Having little experience (or interest) in Javascript, I'm not sure how I might do this.

In reply to Get visitor's screen size. by Seumas

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.