CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 obtaining screen resolution using java & php

Print topic Send  topic

Author Message
MichaelMcDonald

Posts: 638
Posted: 02/21/2013, 8:26 AM



Javascript for obtaining screen resolution (screensize.html)

<script>
window.onload = function() {
if there is no session (session = false)
if (!session) {
// call function to get the screen size
getScreenWidth();

// make ajax call to php page to set the session variable
setSession();
}
}

function getScreenWidth() {
layoutWidth = screen.width;
}

function setSession() {
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
// Reload the page
window.location.reload();
}
}
xmlhttp.open("POST","screensize.php?layoutWidth=" + layoutWidth,true);
xmlhttp.send();
}
</script>


here is the php for obtaining screen resolution (screensize.php)


$width = CCGetFromGet(“width”);
$height = CCGetFromGet(“height”);
here is the php for obtaining screen resolution (screensize.php) Javascript for obtaining screen resolution (screensize.html)
_________________
Central Coast, NSW, Australia.

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.