Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

resolution of client browser

$
0
0
resolution of client browser
Web Connection 5.0
resolution of client browser
09/11/2012
05:13:36 PM
3LF10X8LX Show this entire thread in new window
Gratar Image based on email address
From:
Tuvia Vinitsky
To:
Attachments:
None
If you want to know how much room you have to display, you can also use .innerWidth/Height and .clientWidth/Height

We want to know not only the size but whether the user could maximize his browser or whether his screen is just too small. We do this:

function checkScreen(lcscreen) { var a = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; var b =window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var c = screen.availHeight ; var d = screen.availWidth; var e = screen.height; var f = screen.width; var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); if (lcscreen == "welcome") { // mobile user if (mobile) { // document.location = "http://www.yoursite.com/mobile.html"; alert('Hi V-Manager mobile user!'); return ; } // their browser is smaller than it can be, they could maximize for v-manager if ( (a < 825 && c> 825) || (b <1345 && d >1345) ) { alert('V-Manager for the Cloud is viewed better at a higher resolution.\n\nYour monitor is ' + d + ' x ' + c + '\n\nBrowser display is ' + b + ' x ' + a + '\n\nFor best use adjust your screen resolution and restart your browser.'); return ; } // they need to actually change their screen resolution if ( a < 825 || b <1345 ) { alert('V-Manager for the Cloud is viewed better at a higher resolution.\n\nYour monitor is ' + d + ' x ' + c + '\n\nBrowser display is ' + b + ' x ' + a + '\n\nFor best use adjust your screen resolution and restart your browser.'); return ; } } } <
>


Ok thank you Rick


You can check the window width and make an Ajax call to send that information to the server:

<script type="text/javascript"> var width = $(window).width(); var height = $(window).height(); $.get("BrowserDimensions.wwt",{ width: width, height: height }); </script>

Then on the server:

FUNCTION BrowserDimensions lnWidth = val(Request.QueryString("width")) lnHeight = val(Request.QueryString("height")) *** Save this for the user ENDFUNC

Keep in mind that this is Asynchronous - so you have to render the initial page to get this information. You get the width and height after the initial page has rendered.

Also if you are already using AJAX callbacks or using a few of them in your page it's better to use a real callback handler.

wcdocs:_1wu1b8jkq.htm

Hope this helps,

+++ Rick ---


Hello,

Is it possible to know the resolution of client browser

Thank you in advance

Michel





Viewing all articles
Browse latest Browse all 10393

Trending Articles