Wednesday, February 10, 2010

Detect Javascript is enabled in ASPX programmatically

if (Session["Flag"] == null)
{
Session["Flag"] = "Checked";
string path = Request.Url + "?temp=1";
Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect",
"window.location.href='" + path + "';", true);
}
if (Request.QueryString["temp"] == null)
Response.Write("JavaScript is not enabled.");
else
Response.Write("JavaScript is enabled.");

No comments:

Post a Comment