簡單的偵測Browser是否有enable JavaScript(use aspx)

今天發現一個很簡單偵測client的browser是否有enable javascript, 酷na~

protected void Page_Load(object sender, EventArgs e)
    if (Session["JSChecked"] == null)    //JSChecked -indicates if it tried to run the javascript version
        Session["JSChecked"] = "Checked";    // prevent infinite loop
        string path = Request.Url + "?JScript=1";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect", "window.location.href='" + path + "';", true);
    if (Request.QueryString["JScript"] == null)
        Response.Write("JavaScript is not enabled.");
        Response.Write("JavaScript is enabled.");
Detect if JavaScript is enabled in ASPX

0 意見: