Click to See Complete Forum and Search --> : Help Please


giggledesign
12-07-2003, 10:40 AM
does anybody know where i can find a php code for displaying the users resoloution?

all i need is the simple code to just say:

users resoloution is XXXXxXXX

please help this is quite urgent!


thanks:d

dreamcatcher
12-07-2003, 11:37 AM
Not sure about PHP, but you can do it with Javascript. This is the code I use:



<script language="Javascript"><!--

// ***********************************************
// AUTHOR: WWW.CGISCRIPT.NET, LLC
// URL: http://www.cgiscript.net
// Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( http://www.cgiscript.net/scripts.htm )
// ***********************************************

// for NN4/IE4
if (self.screen) {
width = screen.width
height = screen.height
}

// for NN3 w/Java
else if (self.java) {
var javakit = java.awt.Toolkit.getDefaultToolkit();
var scrsize = javakit.getScreenSize();
width = scrsize.width;
height = scrsize.height;
}
else {

// N2, E3, N3 w/o Java (Opera and WebTV)
width = height = '?'
}

document.write("Your Screen Resolution is set to: "+ width +"×"+ height)

//-->
</script>


Hope that works.

pyro
12-07-2003, 12:54 PM
PHP runs server-side and cannot give you this information. JavaScript is the way to go...

<script type="text/javascript">
document.write(screen.width+"x"+screen.height);
</script>

giggledesign
12-07-2003, 01:23 PM
thanks, i used the second java code and it works effectively.