ScreenSize in JScript
Hi All,
I am using javascript for get screen width and height, Following javascript function i am using:
function test() {
var path = window.location+"?width="+screen.width;
window.location.href(path);
}
On page load event i am using this function with check javascript is enabled or not on page Load Event:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["JSChecked"] == null)
{
Session["JSChecked"] = "Checked";
string path = Request.Url + "?JScript=1";
Page.ClientScript.RegisterStartupScript(this.GetTy pe(), "redirect", "window.location.href='" + path + "';", true);
}
if (Request.QueryString["JScript"] == null)
{
Response.Write("JavaScript is desactivated.<br/>Plz Activate JavaScript");
}
else
if (Request.QueryString["JScript"] != null)
{
if (Request.QueryString["width"] == null)
{
Response.Write("JavaScript is activated.<br>Plz wait Loading...");
Page.ClientScript.RegisterStartupScript(this.GetTy pe(), "test", "test();", true);
Session["JScript"] = "Enabled";
}
else { Page.ClientScript.RegisterStartupScript(this.GetTy pe(), "test", "test();", true); }
}
if (Session["JScript"] != null)
{
Page.ClientScript.RegisterStartupScript(this.GetTy pe(), "test", "test();", true);
Response.Write(Request.QueryString["width"]);
}
Response.Write(Request.QueryString["width"]);
But this is reloading the page. All items are displayed and then they are reloading again.
What is the solution for this reloading the page or get screen size minimum amount of time on page load.
Thanks in advance
__________________
|