locked
Detect Browser Screen Size?? RRS feed

  • Question

  • User-1958576363 posted

    Hi Everyone,  I need to detect the size of the user's screen for mobile devices (especially the BlackBerry). I've read a lot of pages that seem to refer me to the Request.Browser object, but I'm finding that this object doesn't have the correct values. For example, I have a BlackBerry and when I use the Request.Browser to get the screen size, it tells me it is 640x480. Well, I know it's not that big since an image of 300px wide just barely fits. Also, when I run on my desktop browser, it also says my screen is 640x480. I can assure you, it is not 640x480! ha!

      How does anyone reliably get the browser's screen size?? Do I have to revert to some kind of JavaScript? If so, where can I read more about it? Will it be any more reliable? Someone must have an idea about this. Thanks in advance!!

    Tuesday, October 7, 2008 6:19 PM

Answers

  • User1839833660 posted

     U need to use this javascript

     

    <script language="javascript">
    res = "&res="+screen.width+"x"+screen.height+"&d="+screen.colorDepth
    </script>

     

    http://www.devcity.net/Articles/64/1/screenresolution.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 8, 2008 6:35 AM
  • User3423363 posted

    Hello,

    u can get the screen width and height using javascript.

    <Script language="javascript">

    function getScreenSize()

    {

    var screenheight=screen.height;

    alert(screenheight);

    var screenWidth=screen.width

    alert(screenWidth);

    }

    U can get the size of screen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 8, 2008 6:46 AM

All replies

  • User1839833660 posted

     U need to use this javascript

     

    <script language="javascript">
    res = "&res="+screen.width+"x"+screen.height+"&d="+screen.colorDepth
    </script>

     

    http://www.devcity.net/Articles/64/1/screenresolution.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 8, 2008 6:35 AM
  • User3423363 posted

    Hello,

    u can get the screen width and height using javascript.

    <Script language="javascript">

    function getScreenSize()

    {

    var screenheight=screen.height;

    alert(screenheight);

    var screenWidth=screen.width

    alert(screenWidth);

    }

    U can get the size of screen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 8, 2008 6:46 AM
  • User446038550 posted

     

    you can try to use <cite>wurfl.sourceforge.net and it's free[:)]
    </cite>
    Wednesday, October 8, 2008 8:32 PM
  • User981004358 posted

    The latest capabilities list which is available in WURFL is read using 51degrees.mobi Foundation API which detects all mobile devices. It is a .NET open source available here http://51degrees.codeplex.com/releases.

    It easily detects if the request is coming from any mobile device and redirects user to mobile landing page. It has some user friendly samples to try out.

     

    - Thank You

    Friday, August 13, 2010 10:49 AM