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" <no...@nospam.xspam> schreef in bericht
news:122cg21mpem1nbspg...@4ax.com...
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.