Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4575690
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:06:01+00:00 2026-05-21T20:06:01+00:00

I have a page that displays all its content in a TabContainer, but if

  • 0

I have a page that displays all its content in a TabContainer, but if javascript is disabled on the browser it just displays a blank page.

I can add a <noscript> to display all the important content, but the blank TabContainer still renders.

I’d like to add a in the header to redirect to the same page plus ?noscript=true, but it shouldn’t be infinite. I figure using a PlaceHolder control that will put the appropriate <META HTTP-EQUIV="Refresh" CONTENT="0; URL=url?noscript=true"> when the current url doesn’t have the noscript query value.

Then I can set the Visible property to false for the TabContainer when the noscript query value is present.

Is this the right way to go about it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T20:06:02+00:00Added an answer on May 21, 2026 at 8:06 pm

    Well, because I’m thorough, and don’t want to duplicate code, I created this component that does my other answer plus checks session and viewstate for previous detection.

    The value of the component is that it can be used on other pages and it will have access to the same session/cookie value that was used on other pages with the component.

    Any suggestions at improvement?

    using System;
    using System.ComponentModel;
    using System.Linq;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace AspNetLib.Controls
    {
    /*
     * This component should be placed in the <head> html tag and not in the body or form.
     */
    [DefaultProperty("Noscript")]
    [ToolboxData("<{0}:NoJavascript runat=server />")]
    public class NoJavascript : WebControl
    {
        HttpRequest Request = HttpContext.Current.Request;
        HttpSessionState Session = HttpContext.Current.Session;
        HttpResponse Response = HttpContext.Current.Response;
    
        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue(false)]
        [Localizable(true)]
        public bool Noscript
        {
            get
            {
                bool noscript;
                // check if we've detected no script before
                try
                {
                    noscript = Convert.ToBoolean(Session["js:noscript"] ?? false);
                    if (noscript) return true;
                }
                catch { } // if session disabled, catch its error
                HttpCookie Cookie = Request.Cookies["JavascriptDetectionComponent"];
                if (null != Cookie)
                {
                    noscript = !string.IsNullOrEmpty(Cookie["js:noscript"]);
                    if (noscript) return true;
                }
                noscript = Convert.ToBoolean(ViewState["js:noscript"] ?? false);
                if (noscript) return true;
    
                // if we've returned from meta evaluate noscript query setting
                noscript = !string.IsNullOrEmpty(Request["noscript"]);
                if (noscript)
                {
                    SetNoScript();
                    return true;
                }
                return false;
            }
        }
    
        [Bindable(true)]
        [Category("Misc")]
        [DefaultValue("")]
        [Localizable(true)]
        public string CookieDomain
        {
            get { return Convert.ToString(ViewState["CookieDomain"] ?? string.Empty); }
            set { ViewState["CookieDomain"] = value; }
        }
    
        private void SetNoScript()
        {
            try { Session["js:noscript"] = true; }
            catch { }// if session disabled, catch its error
            ViewState["js:noscript"] = true;
            HttpCookie Cookie = new HttpCookie("JavascriptDetectionComponent");
            if (!string.IsNullOrEmpty(CookieDomain))
                Cookie.Domain = CookieDomain;
            Cookie["js:noscript"] = "true";
            Response.Cookies.Add(Cookie);
        }
    
        protected override void RenderContents(HtmlTextWriter output)
        {
            if (!Noscript)
            {
                string url = Request.Url.ToString();
                string adv = "?";
                if (url.Contains('?'))
                    adv = "&";
                string meta = string.Format("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL={0}{1}noscript=true\">",
                    url, adv);
                output.WriteLine("<noscript>");
                output.WriteLine("  " + meta);
                output.WriteLine("</noscript>");
            }
        }
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a page that displays large datasets into html tables. how can i
I have a page that displays messages and I want it to work just
I have a page that displays a list with a of elements with a
I have a page that displays a table in two different modes. In each
I have a page that displays search results and has a DOM like the
I have a page that displays a list of tickets. On each of these
I have a page that displays posts and I want to get the name
I have a web page that displays a list of documents stored on the
I have a page/gsp that displays 3 different classes. This means that I need
I have a JSF page that displays a RichFaces Treeview, from a TreeNodeImpl model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.