You are here: Re: User Display Size « All PHP « IT news, forums, messages
Re: User Display Size

Posted by Mr-t on 09/24/06 07:47

I do something simular, but I use a cookie...

on the splash-screen of th website, the size is of no importance, but
once you visited that page, the rest of the site uses the cookie.

That approach doesn't need a form/user action.

On Fri, 22 Sep 2006 23:40:19 -0500, Summer <noone@nospam.xspam> wrote:

>Thanks Jerry. I know almost nothing about php and even less about
>java. However, on the surface your code looks like it will work. One
>more question if you don't mind. How do I access the height and width
>values?
>
>
>
>On Thu, 14 Sep 2006 21:01:14 +0200, <info@swadd.nl> wrote:
>
>>Hello Summer
>>
>>Try this with javascript That is probably the most elegant option. Most
>>likely the only option.
>>
>>When jou start with a php indexpage you could do something like this.
>>
>>Possible index.php
>>
>><?php
>>session_start();
>>
>>if(isset($_POST['screenwidth'])){
>> // store screenwidth in a session
>> $_SESSION['screenwidth'] = $_POST['screenwidth'];
>>}
>>if(isset($_POST['screenheight'])){
>> // store screenheight in a session
>> $_SESSION['screenheight'] = $_POST['screenheight'];
>>}
>>
>>// determine if screenwidth and heigth is already know. If not do this
>>if(!isset($_SESSION['screenwidth']) || !isset($_SESSION['screenheight'])){
>>?>
>>// simple page for processing javascript to determine screendimensions
>>
>><html>
>><head>
>><title>Welcome</title>
>>
>>//simple script script
>><script language=javascript1.2>
>>function detectUserScreen(){
>>
>> /*determine width*/
>> screenWidth = screen.width;
>> /*determine height*/
>> screenHeight = screen.height;
>>
>> /* Place values in form */
>> document.form1.screenwidth.value = screenWidth;
>> document.form1.screenheight.value = screenHeight;
>>
>> /* Submit form tot index.php*/
>> document.form1.submit();
>>}
>></script>
>>
>></head>
>><body onLoad="javascript:detectUserScreen();">
>>
>><!-- simpel form to contain width and height-->
>><form name="form1" action="index.php" method="POST">
>><input type="hidden" name="screenwidth" value="">
>><input type="hidden" name="screenheight" value="">
>></form>
>>
>><!--nice message to user if server responds slow-->
>><p>Wait for just a second. Page is loading.</p>
>></body>
>></html>
>><?
>>}
>>// if width and height are known do this
>>else{
>> // do something else e.g. go to next page
>> header("location: index1.php");
>>}
>>?>
>>
>>Save the code as index.php and run it.
>>
>>Call your previous index.php index1.php and jour in business.
>>
>>Screenwidth and height are stored in a session till user closes window or
>>you do session_destroy();
>>
>>Hope this helps
>>
>>Jerry
>>
>>"Summer" <noone@nospam.xspam> schreef in bericht
>>news:122cg21mpem1nbspgv4gelqrvhecje3n36@4ax.com...
>>>I want to display an image that will adjust it's size based on the
>>> size of the users window. Is this possible?
>>>
>>>
>>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация