1 Reply Latest reply on May 7, 2003 7:03 AM by jonlee

    How to send browser data down to a servlet?

    erikture

      Hello!

      I am trying to send some data available in the browser down to a servlet. I whant to do this for statistics reasons.

      I would for example like to know the screen resolution of the users computer. There are javascript objects for detecting that, screen.width and screen.height.

      I am trying to send it to a servlet using this code:

      <script language="JavaScript" src="/servlet/statistics?swidth=" + screen.width>

      However nothing is sent to the servlet. I do not manage to send for example navigator.appName eighter. But if I write like this



      The string "testing" is sent to the servlet.
      What is wrong and how to do this?

      /Erik

        • 1. Re: How to send browser data down to a servlet?
          jonlee

          This appears to be a Javascript problem. I don't think concatenating the screen width property as you have done, transforms correctly to a src definition.

          I believe you need something like this:
          src="/servlet/statistics?swidth='+screen.width'"

          or something like that. I'd check on Google for sites that deal with Javascript tricks.