SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was wondering if someone knows if its possible to detect the browser resolution of someone visiting your site using PHP? Something that works across all 4.x browsers and above regardless of OS.

    Example :When using CSS fonts of say 12 pixels they work great on 640x480 or 800x600 but are too tiny on higher resolutions.

    Using the detected browser info it should be possible to create a site with a dynamic appearance that scales the fonts etc.

  2. #2
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are using PHP, I'd definitely move your post over to the Server Side Languages --> PHP forum. You will find much more help over that way.

    Good luck with your question!
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  3. #3
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Done!

  4. #4
    will code HTML for food Michel V's Avatar
    Join Date
    Sep 2000
    Location
    Corsica
    Posts
    552
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think that can be done with PHP, but with JavaScript you can just use conditions to build your local stylesheet according to the screen resolution (since javascript is capable of detecting it), with the document.write function.
    Then you can use PHP or SSI to include that little bit of javascript on your pages, since you don't want to edit all pages manually.
    [blogger: zengun] [blogware contributor: wordpress]

  5. #5
    SitePoint Enthusiast emke's Avatar
    Join Date
    Jun 2000
    Location
    somewhere
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't detect a browser resolution, you need a javascript function to do that as was previously mentioned.

    If you still want to use PHP then I would suggest this script that can detect almost anything else.

    http://www.asphyxia.com/PHP_BD/PHPCl...ifferDemo.php3


  6. #6
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    Washington State
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is a JavaScript issue. Here's a way I hacked together awhile ago to get resolution values to PHP (I'm a javascript novice)
    Code:
    <head> 
    <SCRIPT language="JavaScript"> 
    <!-- 
    var w = screen.width; 
    var h = screen.height; 
    
    window.location.replace("<?php echo $PHP_SELF ?>?w=" + w + "&h=" + h); 
    
    //--> 
    </SCRIPT> 
    </head>
    GET variables $h is height and $w is width.


Bookmarks

Posting Permissions

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