post icon

Screen resolution using java script and using it in php

use this code to set screen resolution into a cookie

< script language=”javascript”>
<!–
writeCookie();
function writeCookie()
{
var today = new Date();
var the_date = new Date(“December 31, 2023”);
var the_cookie_date = the_date.toGMTString();

var the_cookie = “users_resolutionx=”+ screen.width ;
var the_cookie = the_cookie + “;expires=” + the_cookie_date;
document.cookie=the_cookie

var the_cookie = “users_resolutiony=”+ screen.height ;
var the_cookie = the_cookie + “;expires=” + the_cookie_date;
document.cookie=the_cookie

}
//–>
</script>

 

use this code to access screen size

 

<? php

$x = $_COOKIE[users_resolutionx];
$y = $_COOKIE[users_resolutiony];
?>

Comments are closed.

Leave a comment