Results 1 to 9 of 9

Thread: [RESOLVED] Screen Resolution

  1. #1

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Resolved [RESOLVED] Screen Resolution

    Right to settle this, i have searched etc

    I understand the only way to get a users screen res is through javascript, but im not sure how to take those two values and put them into variables?

    I have tried the following....

    PHP Code:
    <?php

    $me
    =?><input type="text" size="20" name="t1" value="not supported"><?php ;

    echo 
    $me;

    ?>


    <script>

    <!--
    function show(){
    if (!document.all&&!document.layers)
    return
    document.t.t1.value=screen.width
    document.t.t2.value=screen.height
    document.t.t3.value=screen.colorDepth
    document.t.t4.value=screen.pixelDepth
    }
    show()
    //-->
    </script>

  2. #2
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Screen Resolution

    You need to sumit the value using a form, for using a HTTP request with AJAX.

    PHP is a server side language and is executed before the page gets the browser, Javascript is a client side language and has no knowledge of any processing that happens on the server.

  3. #3

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Screen Resolution

    Quote Originally Posted by john tindell
    You need to sumit the value using a form, for using a HTTP request with AJAX.

    PHP is a server side language and is executed before the page gets the browser, Javascript is a client side language and has no knowledge of any processing that happens on the server.
    Ah i see, what i want to do is display a warning message for users with screen reolutions lower than 800 by 600.

    Any ideas (Y)

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Screen Resolution

    Is this because you can't make your layout work below 800x600?

  5. #5
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Screen Resolution

    Quote Originally Posted by I_Love_My_Vans
    Ah i see, what i want to do is display a warning message for users with screen reolutions lower than 800 by 600.

    Any ideas (Y)
    This is very easy to do. Just check the document.body.clientWidth and document.body.clientHeight values. If they're lower than 800 and 600, use an alert().

    If you do do this, please post the website's URL so I can block it on my router. I cannot stand websites that pop-up useless boxes and though my experience at being a user interface developer, I find users try to get out of the website when a pop-up like an alert() pops up.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Screen Resolution

    Don't display a warning. Make the site so it looks good on a 600x800 resolution; then when the page loads, if the resolution is higher; resize the elements so they fit the higher resolution. If it is lower they will just have to scroll. Computers are awkward to use in general if you are silly enough to use a lower resolution, I am sure the they don't need to be reminded.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  7. #7

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Screen Resolution

    My site view perfectly in 800 x 600

    Just below that it gets a little :S <--

  8. #8
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Screen Resolution

    Well, that's your fault and you shouldn't annoy people about it.

  9. #9

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Screen Resolution

    Right, point taken

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width