Jump to content

[SOLVED] Get Screen Resolution Into A Variable


Dan_Mason

Recommended Posts

I have got the correct javascript code to get the users current screen resolution, but i am having a few problems putting the numbers into PHP Variables.

 

Here is the code i have so far:

 

<html>
<head>
<script language="Javascript1.1">

function detect(){
if(screen.width<1280||screen.height<1024){
alert("Your current resolution is "+screen.width+" by "+screen.height+"")
}

}
</script>
</head>
<body>


</body>
</html>

 

Any suggestions?

 

Cheers, Dan.

You could set the screen resolution into a cookie, and then read it with php...

//Javascript
document.cookie = "name=value; expires=date; path=path;
                   domain=domain; secure";

<?php
$yourCookie = $_COOKIE['name'];

 

Edit: A quick Google search yield this particular search result: http://www.phpbuddy.com/article.php?id=8

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.