How to obtain screen resolution in Asp.net

Source: Internet
Author: User

When I downloaded the wallpaper today, I found such a user-friendly setting:

So how does one detect "Computer resolution? Below is a simple solution, but there are defects.

<Script language = "JavaScript">

VaR width = screen. width;
VaR Height = screen. height;

If (width <1280 | height <1024)
{
Alert ("this web page is best viewed with a screen resolution of 1280 by 1024 or higher. your current resolution is "+ width +" by "+ height + ". if possible please change your resolution. ");
}
Else
{
Alert ("your screen resolution is pretty big! ")
}
</SCRIPT>

The aboveProgramYou can get the correct screen resolution in Google Chrome, but the numbers in IE differ greatly.

BrowserWidthHeightComparison with practice

Chrome1366769Correct

Ie91249702Error

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.