More in this section
Forums / Designing with Sitefinity / detecting screen resolutions in sitefinity

detecting screen resolutions in sitefinity

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Jome Akpoduado
    Jome Akpoduado avatar
    16 posts
    07 Jan 2010
    16 Feb 2010
    Link to this post
    Hi guys,
    is it possible to detect the screen resolution of a client and adjusting the use of appropriate css files accordingly. How would I go about this if it is?

    Many thanks

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    16 Feb 2010
    Link to this post
    Hello Jome Akpoduado,

    Below is a sample code that illustrates how to detect the screen resolution

    <script language="javascript">
        $(document).ready(function() {
            res = "Screen Resolution is: " + screen.width + "x" + screen.height;
            if ((screen.width >= 1024) && (screen.height >= 768)) {
                window.location = "";
            else {
                window.location = "";

    You can register the script on the serve by using Page.ClientScript.RegisterStartupScript(this.GetType(), "SomeKey", checkres); and then before the page renders you can add the needed stylesheets to the page header (Page.Header.Controls.Add( control );)

    protected void Page_Init(object sender, EventArgs e)
      HtmlLink myHtmlLink = new HtmlLink();
      myHtmlLink.Href = "~/StyleSheet.css";
      myHtmlLink.Attributes.Add("rel", "stylesheet");
      myHtmlLink.Attributes.Add("type", "text/css");
      // Add the HtmlLink to the Head section of the page.

    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered