mirror of
https://github.com/php/web-pres2.git
synced 2026-04-29 18:03:09 +02:00
6097586460
+ note: maybe we should some day save the dimension information in a session variable so that the presentation system is cookie-independent.
27 lines
831 B
PHP
27 lines
831 B
PHP
<?/*
|
|
A bit of fancy footwork to get the browser's inside dimensions in
|
|
pixels. Should work on both NS4+ and IE4+. If it doesn't we default
|
|
it to something sane. The dimensions are returned to the server via
|
|
a Javascript cookie so as to not muck up our nice clean URL. The
|
|
function is called if we don't have the dimensions already, or on a
|
|
resize event to fetch the new window dimensions.
|
|
*/?>
|
|
<script language="JavaScript" defer="defer">
|
|
<!--
|
|
function get_dims() {
|
|
var winW = 1024;
|
|
var winH = 650;
|
|
|
|
if (window.innerWidth) {
|
|
winW = window.innerWidth;
|
|
winH = window.innerHeight;
|
|
} else if (document.all) {
|
|
winW = document.body.clientWidth;
|
|
winH = document.body.clientHeight;
|
|
}
|
|
document.cookie="dims="+winW+"_"+winH;
|
|
location.reload(false);
|
|
}
|
|
//-->
|
|
</script>
|