#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Chicago, IL USA
    Posts
    48
    Rep Power
    18
    The only way I know of to log the visitors screen width and color bit depth is to use JavaScript.

    <script language="javascript">
    $width = screen.Width;
    $height = screen.Height;
    $color = screen.colorDepth;
    </script>

    ...I'm trying to get this information over to php so I can enter the results in a mysql database. Any suggestions?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Herne Bay, Kent, UK
    Posts
    30
    Rep Power
    15
    if you're just logging stats, it'll be something like this (use the GD functiuons to generate an image that logging.php3 will generate)
    <script language="javascript">
    width=screen.Width;
    //etc...

    document.write("<img src="logging.php3?width="+width+">");
    </script>

    or if you want to tell PHP what size screen the user has so it loads the main page properly, you'll have to do the following:

    <script language="javascript">
    width=screen.Width;
    //etc...

    //this'll need to go between <head> and </head>
    document.write("<meta HTTP-EQUIV="Refresh" CONTENT="0; URL=mainpage.php3?width="+width+"
    >");

    </script>
    [couldn't be bothered to escape the quotes! ]
    the final way to do it is to get users to log in, expressing their preferences for depth and resolution...

    hope this helps

    [This message has been edited by biscuit (edited September 06, 2000).]

    [This message has been edited by biscuit (edited September 06, 2000).]

Similar Threads

  1. PHP scripts to run in Javascript continuously
    By linhardt in forum JavaScript Development
    Replies: 0
    Last Post: February 13th, 2004, 03:51 PM
  2. pass php value of a varible to javascript variable
    By fluke_tony in forum JavaScript Development
    Replies: 1
    Last Post: February 13th, 2004, 04:34 AM
  3. javascript inside php tags
    By andy123 in forum JavaScript Development
    Replies: 5
    Last Post: February 5th, 2004, 05:34 PM
  4. Javascript in PHP
    By tintintin in forum JavaScript Development
    Replies: 5
    Last Post: January 28th, 2004, 06:40 AM
  5. escaping quotes. Javascript within PHP
    By metro in forum JavaScript Development
    Replies: 2
    Last Post: January 23rd, 2004, 02:50 PM

IMN logo majestic logo threadwatch logo seochat tools logo