G
Grzegorz Klimsa
Hi !
I have a problem wiht detecting resolution of client web browser
I prepare several files of css style for different browsers and different
resolutions,
(such as : Style_1024x768.css ; Styleff_1024x768.css; Style_1280x1024.css ;
Styleff_1280x1024.css )
I want to set css style file depends on resolution browser
I wrote this script to detect type of browsers, but i don't have any idea
how to detect resolution ???
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<script runat="server">
protected void Page_Init(object sender, EventArgs e)
{
// Define an HtmlLink control.
string type = Request.Browser.Type;
HtmlLink myHtmlLink = new HtmlLink();
if (type == "IE7")
{
myHtmlLink.Href = "Style_1280x1024.css";
myHtmlLink.Attributes.Add("rel", "stylesheet");
myHtmlLink.Attributes.Add("type", "text/css");
// Add the HtmlLink to the Head section of the page.
Page.Header.Controls.Add(myHtmlLink);
}
else
{
myHtmlLink.Href = "Styleff_10280x1024.css";
myHtmlLink.Attributes.Add("rel", "stylesheet");
myHtmlLink.Attributes.Add("type", "text/css");
// Add the HtmlLink to the Head section of the page.
Page.Header.Controls.Add(myHtmlLink);
}
}
Greetings
Grzegorz
I have a problem wiht detecting resolution of client web browser
I prepare several files of css style for different browsers and different
resolutions,
(such as : Style_1024x768.css ; Styleff_1024x768.css; Style_1280x1024.css ;
Styleff_1280x1024.css )
I want to set css style file depends on resolution browser
I wrote this script to detect type of browsers, but i don't have any idea
how to detect resolution ???
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<script runat="server">
protected void Page_Init(object sender, EventArgs e)
{
// Define an HtmlLink control.
string type = Request.Browser.Type;
HtmlLink myHtmlLink = new HtmlLink();
if (type == "IE7")
{
myHtmlLink.Href = "Style_1280x1024.css";
myHtmlLink.Attributes.Add("rel", "stylesheet");
myHtmlLink.Attributes.Add("type", "text/css");
// Add the HtmlLink to the Head section of the page.
Page.Header.Controls.Add(myHtmlLink);
}
else
{
myHtmlLink.Href = "Styleff_10280x1024.css";
myHtmlLink.Attributes.Add("rel", "stylesheet");
myHtmlLink.Attributes.Add("type", "text/css");
// Add the HtmlLink to the Head section of the page.
Page.Header.Controls.Add(myHtmlLink);
}
}
Greetings
Grzegorz