-1

Sometime ago i disable javascript on my google chrome browser, and think how the website owner will detect if a user is disable javascript on that website, and i search on google and found answer of this question on stackoverflow. Here is the Link : click to show question .

After that i wrapped our all content of a page in the class pagecontainer of the body tag something like this :

<body class="pagecontainer">
    <noscript>
        <style type="text/css">
            .pagecontainer {display:none;}
        </style>
        <div class="noscriptmsg">
        You don't have javascript enabled.  Good luck with that.
        </div>
    </noscript>
    //all page content is here
</body>

after that i disable javascript for this page, and tries to run this page, but i could't get the message which is wrapped within noscriptmsg class. So plz help us to give the message which is given in the noscriptmsg class if the user disable the javascript for this page.

Community
  • 1
  • 1
Manohar Kumar
  • 605
  • 9
  • 12

1 Answers1

2

Your CSS in the <noscript> block makes the entire <body> be hidden, and your <noscript> tag is part of the <body>.

You could change it to something like this:

<body>
    <noscript>
        <style type="text/css">
            .pagecontainer {display:none;}
        </style>
        <div class="noscriptmsg">
        You don't have javascript enabled.  Good luck with that.
        </div>
    </noscript>
    <section class=pagecontainer>
      //all page content is here
    </section>
</body>

An alternative is that you can put a <meta> tag in your <noscript> block to redirect the browser to your "please enable JavaScript" page. That way your normal pages don't have to worry about it:

<!DOCTYPE html>
<html>
  <head>
    <noscript>
      <meta http-equiv="refresh" content="0; url=http://your.domain/noscript.html">
    </noscript>
Pointy
  • 405,095
  • 59
  • 585
  • 614