Print Page | Close Window

screen resolution

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=30747
Printed Date: 28 March 2024 at 1:10pm
Software Version: Web Wiz Forums 12.07 - https://www.webwizforums.com


Topic: screen resolution
Posted By: Roberto Randall
Subject: screen resolution
Date Posted: 08 May 2013 at 8:34pm
I wish to know how I can detect the users screen resolution. I want to display an ad on the side of the forum if the resolution is higher than 1024.

Example:

Dim strScreen
Dim strShow

strScreen = "user screen resolution"
If strScreen => "1024" Then strShow = True

Thank you,

-------------
https://www.lanocion.es - https://www.lanocion.games - https://www.lanocion.chat



Replies:
Posted By: WebWiz-Bruce
Date Posted: 09 May 2013 at 9:30am
You would need to use JavaScript to detect the screen resolution of the visitor:-

http://www.javascriptkit.com/howto/newtech3.shtml" rel="nofollow - http://www.javascriptkit.com/howto/newtech3.shtml


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: wistex
Date Posted: 08 September 2013 at 1:33am
Is there a way to pass that information directly to ASP?  The only way I figured out how to do that is have the Javascript set a cookie, and then on the next page load read the cookie to get the resolution.


-------------
http://www.wistex.com" rel="nofollow - WisTex Solutions
http://www.caribbeanchoice.com/forums" rel="nofollow - CaribbeanChoice Forums


Posted By: xentia
Date Posted: 15 September 2013 at 9:56pm
You can pass JavaScript results to ASP server side page with some simple form like:


<html>
<body>
<form target="set_resolution.asp" method="post" id="frm_scr" name="frm_scr">
<input type="hidden" id="scr_width" value="">
<input type="hidden" id="scr_height" value="">
</form>
<script>
document.getElementById(scr_width'').value=document.body.clientWidth;
document.getElementById('scr_height').value=document.body.clientHeight;
document.getElementById('frm_scr').submit();
</script>
</body>
<html>

====================
be note that document.body.clientHeight/Width is available in IE 8+. There is other way to get screen dimensions with JavaScript, but the idea to pass that data to ASP is same. Hope that this help



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net