Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - screen resolution
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

screen resolution

 Post Reply Post Reply
Author
Roberto Randall View Drop Down
Senior Member
Senior Member
Avatar

Joined: 21 August 2009
Location: San Pedro Alc.
Status: Offline
Points: 260
Post Options Post Options   Thanks (0) Thanks(0)   Quote Roberto Randall Quote  Post ReplyReply Direct Link To This Post Topic: screen resolution
    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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9791
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2013 at 9:30am
You would need to use JavaScript to detect the screen resolution of the visitor:-

Back to Top
wistex View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 30 August 2003
Location: United States
Status: Offline
Points: 877
Post Options Post Options   Thanks (0) Thanks(0)   Quote wistex Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
xentia View Drop Down
Newbie
Newbie


Joined: 23 July 2007
Location: Bulgaria
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote xentia Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.