How to get at the clients' screen size ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Erik

    How to get at the clients' screen size ?

    I want to write a Server Side PHP program that generates a HTML page
    client side.
    How would I get at the clients' screen size, before serving the
    generated page ?
    Would it be a two-step process: first let the client execute a piece
    of JavaScript to generate Height and Width, and then send those values
    to the PHP server (FORM, PUT) ?
    Or can it be done in only one PHP program ?


    frgr
    Erik
  • Ian.H

    #2
    Re: How to get at the clients' screen size ?

    On Mon, 05 Apr 2004 16:26:46 +0200, Erik wrote:
    [color=blue]
    > I want to write a Server Side PHP program that generates a HTML page
    > client side.[/color]


    OK...

    [color=blue]
    > How would I get at the clients' screen size, before serving the
    > generated page ?[/color]


    Wow! Umm.. silly question.. why on earth would you want to do this!?

    [color=blue]
    > Would it be a two-step process: first let the client execute a piece
    > of JavaScript to generate Height and Width, and then send those values
    > to the PHP server (FORM, PUT) ?[/color]


    If you _really_ want to do this.. yes.

    [color=blue]
    > Or can it be done in only one PHP program ?[/color]


    No. As you stated in your first sentence, PHP is server-side and knows
    nothing of the client's environment.

    _IMO_ this is a complete waste of time, effort and resources.

    What about if I visit? or Lynx users? neither would run any Javascript you
    add thus defeating your idea before it's off the ground =)



    Regards,

    Ian

    --
    Ian.H
    digiServ Network
    London, UK


    Comment

    • Erik

      #3
      Re: How to get at the clients' screen size ?

      On Mon, 05 Apr 2004 14:57:55 GMT, the right honourable "Ian.H"
      <ian@WINDOZEdig iserv.net> wrote:
      [color=blue]
      >On Mon, 05 Apr 2004 16:26:46 +0200, Erik wrote:
      >[color=green]
      >> I want to write a Server Side PHP program that generates a HTML page
      >> client side.[/color]
      >
      >
      >OK...
      >
      >[color=green]
      >> How would I get at the clients' screen size, before serving the
      >> generated page ?[/color]
      >
      >
      >Wow! Umm.. silly question.. why on earth would you want to do this!?[/color]


      To determin the exact layout, to determin the screen real estate
      available to me to build the page....
      Pages for a 640 screen would be different from a 1280 screen...

      [color=blue]
      >
      >[color=green]
      >> Would it be a two-step process: first let the client execute a piece
      >> of JavaScript to generate Height and Width, and then send those values
      >> to the PHP server (FORM, PUT) ?[/color]
      >
      >
      >If you _really_ want to do this.. yes.
      >
      >[color=green]
      >> Or can it be done in only one PHP program ?[/color]
      >
      >
      >No. As you stated in your first sentence, PHP is server-side and knows
      >nothing of the client's environment.
      >
      >_IMO_ this is a complete waste of time, effort and resources.
      >
      >What about if I visit? or Lynx users? neither would run any Javascript you
      >add thus defeating your idea before it's off the ground =)
      >[/color]

      still: would be nice to have a few client parameters, before building
      the page...
      Seems I am stuck with the least common denominator... a 640x480 or
      something like that screen.... or build by ratios...
      [color=blue]
      >
      >
      >Regards,
      >
      > Ian[/color]

      Comment

      • Garp

        #4
        Re: How to get at the clients' screen size ?


        "Erik" <et57 at correos calor dot com> wrote in message
        news:hlh370dl8i 5f6i80cv6keta59 gq0hlsobr@4ax.c om...[color=blue]
        > On Mon, 05 Apr 2004 14:57:55 GMT, the right honourable "Ian.H"
        > <ian@WINDOZEdig iserv.net> wrote:[/color]
        <snip>[color=blue][color=green]
        > >Wow! Umm.. silly question.. why on earth would you want to do this!?[/color]
        >
        >
        > To determin the exact layout, to determin the screen real estate
        > available to me to build the page....
        > Pages for a 640 screen would be different from a 1280 screen...
        >[/color]
        <snip>

        Well, ugh. Make a layout that assumes nothing about the client and you won't
        have to. Like most technical problems, this one stems from unwise design
        choices. When the user resizes his browser window to look at something else
        at the same time, are you going to regenerate the page for him?

        Garp


        Comment

        • Hayden Kirk

          #5
          Re: How to get at the clients' screen size ?

          More than 50% of peoples resolution are 1024/768 soo... You don;t need to
          worry. Less than 10% is more than that, the rest is really 800x600.

          - Hayden

          "Erik" <et57 at correos calor dot com> wrote in message
          news:94r270hbvs 6l0dptg191iqlq8 dgk9o6ga2@4ax.c om...[color=blue]
          > I want to write a Server Side PHP program that generates a HTML page
          > client side.
          > How would I get at the clients' screen size, before serving the
          > generated page ?
          > Would it be a two-step process: first let the client execute a piece
          > of JavaScript to generate Height and Width, and then send those values
          > to the PHP server (FORM, PUT) ?
          > Or can it be done in only one PHP program ?
          >
          >
          > frgr
          > Erik[/color]


          Comment

          • Pedro Graca

            #6
            Re: How to get at the clients' screen size ?

            Hayden Kirk wrote:[color=blue]
            > More than 50% of peoples resolution are 1024/768 soo... You don;t need to
            > worry. Less than 10% is more than that, the rest is really 800x600.[/color]

            My User-Agent string is:
            ELinks/0.9.1 (textmode; Linux 2.6.4-1-386 i686; 108x46)

            Yes, I know I'm one of the very few people in the whole wide world
            who are completely shut out of a rapidly growing list of sites.

            --
            USENET would be a better place if everybody read: : mail address :
            http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
            http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
            http://www.expita.com/nomime.html : to 10K bytes :

            Comment

            • Chung Leong

              #7
              Re: How to get at the clients' screen size ?

              "Erik" <et57 at correos calor dot com> wrote in message
              news:94r270hbvs 6l0dptg191iqlq8 dgk9o6ga2@4ax.c om...[color=blue]
              > I want to write a Server Side PHP program that generates a HTML page
              > client side.
              > How would I get at the clients' screen size, before serving the
              > generated page ?[/color]

              You can't. Currently there's no mechanism for client capability discovery in
              HTTP.
              [color=blue]
              > Would it be a two-step process: first let the client execute a piece
              > of JavaScript to generate Height and Width, and then send those values
              > to the PHP server (FORM, PUT) ?[/color]

              That's probably the only way. What you would do is assume the smaller size,
              then redirect to the same page with the dimension added to the URL when more
              space is available. Don't use the screen size though, as you can't assume
              that the user will have the browser window maximized. Use the dimension of
              the browser client area instead:

              var h = document.body.c lientWidth;
              var w = document.body.c lientHeight;

              if(h > 800 && w > 600) {
              location.replac e(location.href + '?height=' + w + '&width=' + h);
              }

              A more ideal solution would dynamically link in a CSS style-sheet for the
              larger available area.


              Comment

              • Sandman

                #8
                Re: How to get at the clients' screen size ?

                In article <94r270hbvs6l0d ptg191iqlq8dgk9 o6ga2@4ax.com>,
                Erik <et57 at correos calor dot com> wrote:
                [color=blue]
                > I want to write a Server Side PHP program that generates a HTML page
                > client side.
                > How would I get at the clients' screen size, before serving the
                > generated page ?
                > Would it be a two-step process: first let the client execute a piece
                > of JavaScript to generate Height and Width, and then send those values
                > to the PHP server (FORM, PUT) ?
                > Or can it be done in only one PHP program ?[/color]

                Yes, run a page that has a javascript that just loads your php page if the
                variables for the screens size exist, or have the user choose from a list of
                predefined resolutions.

                --
                Sandman[.net]

                Comment

                • Brandon Blackmoor

                  #9
                  Re: How to get at the clients' screen size ?

                  Erik wrote:[color=blue]
                  >
                  > To determin the exact layout, to determin the screen
                  > real estate available to me to build the page...[/color]

                  Hey Erik: 1995 called, and they want their broken web design techniques
                  back.

                  Do yourself and anyone who look at your web site a favor, and read up on
                  the web standards, most of which date from the late 1990s (this, of
                  course, is 2004): http://webstandards.org/

                  bblackmoor
                  2004-04-06

                  Comment

                  • John Dunlop

                    #10
                    [OT] Irrelevant user information (was: How to get at the clients' screen size ?)

                    Pedro Graca wrote:
                    [color=blue]
                    > Hayden Kirk wrote:
                    >[color=green]
                    > > More than 50% of peoples resolution are 1024/768 soo... You don;t
                    > > need to worry.[/color][/color]

                    I start worrying when my website gets crippled by incompetent, soi-
                    disant designers too enamoured with their treasured gimcracks to care
                    about end-users.
                    [color=blue][color=green]
                    > > Less than 10% is more than that, the rest is really 800x600.[/color][/color]

                    Really? Hasn't anyone told you that 97 % of statistics are made up?

                    As to webpage authoring, screen dimensions are irrelevant; browser
                    window dimensions are irrelevant; canvas dimensions are irrelevant.
                    If you disagree with any of that, would you say that my system's
                    volume is relevant? If not, why not?
                    [color=blue]
                    > My User-Agent string is:
                    > ELinks/0.9.1 (textmode; Linux 2.6.4-1-386 i686; 108x46)[/color]

                    That's informative.

                    Unfortunately, ignorant designers being two a penny now, user-agents
                    have taken to working against the intention of RFC2616. As I'm sure
                    you'll know already, Pedro, the User-Agent header "contains
                    information about the user agent originating the request" (RFC2616,
                    sec. 14.43); it isn't supposed to contain information about other
                    user-agents; it definitely isn't supposed to contain misinformation.
                    But it's almost standard practice nowadays for browsers to identify
                    themselves as one another, and to give users a choice of user-agent
                    strings. One of my screenreaders identifies itself as Mozilla/4.0!
                    [color=blue]
                    > Yes, I know I'm one of the very few people in the whole wide world
                    > who are completely shut out of a rapidly growing list of sites.[/color]

                    If by "very few" you mean "many" (or "relatively few"), then I
                    suppose I must agree. :-) One might understandably be surprised at
                    how easy it is to be excluded from websites rigged up by designers
                    who are long on complacency and short on sound advice.



                    --
                    Jock

                    Comment

                    • Geoff Berrow

                      #11
                      Re: [OT] Irrelevant user information (was: How to get at the clients' screen size ?)

                      I noticed that Message-ID:
                      <MPG.1addc184cc eee10c9896df@Ne ws.Individual.N ET> from John Dunlop
                      contained the following:
                      [color=blue]
                      >If by "very few" you mean "many" (or "relatively few"), then I
                      >suppose I must agree. :-) One might understandably be surprised at
                      >how easy it is to be excluded from websites rigged up by designers
                      >who are long on complacency and short on sound advice.
                      >
                      > http://www.google.com/search?q=%22yo...%20doesn%20%22[/color]

                      The picture doesn't look quite so bad if you exclude frames


                      --
                      Geoff Berrow (put thecat out to email)
                      It's only Usenet, no one dies.
                      My opinions, not the committee's, mine.
                      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

                      Comment

                      • Ian.H

                        #12
                        Re: [OT] Irrelevant user information (was: How to get at the clients' screen size ?)

                        On Wed, 07 Apr 2004 08:43:33 +0100, John Dunlop wrote:

                        [color=blue]
                        > Unfortunately, ignorant designers being two a penny now[/color]


                        Typically windoze (l)users / deezyners and think that IE is the be all and
                        end all.

                        It must be horrible having tunnel vision.. blurry tunnel vision at that.



                        Regards,

                        Ian

                        --
                        Ian.H
                        digiServ Network
                        London, UK


                        Comment

                        • Garp

                          #13
                          Re: How to get at the clients' screen size ?


                          "Erik" <et57 at correos calor dot com> wrote in message
                          news:94r270hbvs 6l0dptg191iqlq8 dgk9o6ga2@4ax.c om...[color=blue]
                          > I want to write a Server Side PHP program that generates a HTML page
                          > client side.
                          > How would I get at the clients' screen size, before serving the
                          > generated page ?
                          > Would it be a two-step process: first let the client execute a piece
                          > of JavaScript to generate Height and Width, and then send those values
                          > to the PHP server (FORM, PUT) ?
                          > Or can it be done in only one PHP program ?
                          >
                          >
                          > frgr
                          > Erik[/color]

                          First, yes, but second, don't do it:


                          Moral is, don't design your pages around the dimensions of the window that
                          called the page up. Just make it fit 800x600 if you have to assume a size (>
                          80% users), but better yet, make it fit ANY size with relative sizing. The
                          user can always scroll sideways (unless they use WebTV, but hey).

                          Garp


                          Comment

                          • Ian.H

                            #14
                            Re: How to get at the clients' screen size ?

                            On Thu, 08 Apr 2004 16:16:21 +0000, Garp wrote:


                            [ snip ]
                            [color=blue]
                            > The user can always scroll sideways (unless they use WebTV, but hey).[/color]


                            And this is another of the most infamous pet hates!

                            Avoid the horizontal scroll bars like the plague =)

                            Your "relative size" statement was much better.. make it fit "any" browser
                            size.



                            Regards,

                            Ian

                            --
                            Ian.H
                            digiServ Network
                            London, UK


                            Comment

                            Working...