Re[2]: [liphp] Sample Code (Improved) - Other problems

Orrin Edwards [email protected]
Thu, 16 Oct 2003 06:27:06 -0700 (PDT)


Thanks Alexander... lots of good ideas here... time to do some more
playing with the code!

--- "Alexander (Sasha) Mejenkov" <[email protected]> wrote:
> Hope this will help
> 
> Below is a script that in addition to user's screen resolution
> gives
> also an actual size of browser window. Generally you can add to
> BrowserEnvironment() function any parameters you like. Fow
> example I
> use screen resolution for loading one or another company logo in
> order to fill the whole browser window width when it's completely
> maximized. Of course it's up to the user to maximize window or
> not. If
> he wants to keep browser window 2x3 inches... well it's his
> right. But
> in this case he has to pay for this freak by scrolling a page.
> 
> You can use visible browser window size in order to advise a
> user, for
> example: "Please maximize your browser in order to see details"
> 
> > Although the screen resolution problem is solved, it does
> present
> > other problems...
> > Since the resolution is part of the page URL that is in the
> users
> > address window, if he bookmarks the page, it will include the
> > resolution he used at that time. If this URL is passed to
> others,
> > the resolution info may be incorrect.
> 
> > Does anyone know of a way to 'reset' the users address window
> at
> > the end of the page load... or present a clickable link for
> > creating a bookmark.
> 
> Just redirect user wherever you want were he can maje bookmarks
> etc.
> See code below "fclose($fd1)" line;
> 
> <?php
> if (isset($_GET['resolution']) &&
> isset($_GET['browvisiblesize'])) {
>    $resolution = "Screen resolution is 
> ".urldecode($_GET['resolution']);
>    $browvisiblesize = "Browser window visible size is 
> ".urldecode($_GET['browvisiblesize']);
>    $agent = "agent.log";
>    $fd1 = fopen($agent, "a");
>    $today = getdate();
>    $year = $today['year'];
>    $month = $today['mon'];
>    $day = $today['mday'];
>    $hour = $today['hours'];
>    $min = $today['minutes'];
>    $adata = $_SERVER["HTTP_USER_AGENT"];
>    $agent_log = "$year-$month-$day $hour:$min  ";
>    $agent_log .=  "{$adata}\n";
>    $agent_log .=  "$resolution\n";
>    $agent_log .=  "$browvisiblesize\n\n";
>    fwrite($fd1, "$agent_log");
>    fclose($fd1);
>    // echo $agent_log;
>                 
>    // Now when we have log file saved redirect user
>    // wherever you want so he can make a bookmark or
>    // see your home page
>    $target_page = "https://www.liphp.org";
>    echo '<script>window.location="'.$target_page.'"</script>';
>    }
> else {
> ?>
> <SCRIPT LANGUAGE="JavaScript">
> <!--
> function VisibleHeight() {
>         if (window.innerHeight != null)
>                 return window.innerHeight; 
>         if (document.body.clientHeight != null)
>                 return document.body.clientHeight;
>         return (null);
> }
> 
> function VisibleWidth() {
>         if (window.innerWidth != null)
>                 return window.innerWidth;
>         if (document.body.clientWidth != null)
>                 return document.body.clientWidth;
>         return (null);
> }
> 
> function BrowserEnvironment() {
>         // Screen resolution
>         var height=0;
>         var width=0;
>         
>         // Browser visible window size
>         var brow_visible_win_height=0;
>         var brow_visible_win_width=0;
> 
>         width = screen.width;
>         height = screen.height;
>         
>         brow_visible_win_height = VisibleHeight();
>         brow_visible_win_width = VisibleWidth();
> 
>         window.location='<?php echo
>
$_SERVER['PHP_SELF'];?>'+'?resolution='+width+'x'+height+'&browvisiblesize='+brow_visible_win_width+'x'+brow_visible_win_height;
> }
> 
> // -->
> </SCRIPT>
> <html>
> <head>
>         <title></title>
> </head>
> 
> <body onLoad="BrowserEnvironment()">
> </body>
> </html>
> 
> <?php
> }
> ?>
> 
> 
> _______________________________________________
> Liphp mailing list
> [email protected]
> https://www.liphp.org/mailman/listinfo/liphp
> 
> 


=====
Orrin - Long Island, New York
http://www.orrin.org/            Site Index
http://www.orrin.org/carib/    Caribbean Index
http://www.orrin.org/syocc/   Syosset Camera Club
http://www.orrin.org/aruba/   Aruba Trip Notes  

Linux by SuSE... a world without Windows!