How to determine if javascript user is disabled?

I talked with a friend about users who do not have javascript in the browser, and what can be done to show them the "no javascript" version of your site.

Is this possible and how can this be done?

Thoughts?

+3
source share
7 answers

Do not try to create separate JS versions and non-JS versions of the site. Build a non-JS version, and then upgrade it with JS . This simplifies code reuse, allows the use of object / function detection for the entire stack, and makes it less likely that users without JavaScript will be left if developers update one branch of the site, but not the other.

+16
source

If you mean javascript, find the <noscript>HTML tag .

+7
source

JavaScript , , :

<script type="text/javascript">
     location.replace('http:javascript-version-of-your-site');
</script>
+4

:

<html>
<head>
<noscript>
<meta http-equiv="refresh" content="0;url=http://foo/noscript.htm" />
</noscript>
</head>
<body>
...

( ) , script. , noscript , javascript. , javascript ( ), .

+1

JavaScript CSS

<html>
<style type="text/css">
    .js-on
    {
        display: none;
    }
    .js-off
    {
        background: red;
        color: White;
    }
 </style>
 <div id='jsdetect' class='js-off'><b>Javascript is OFF</b></div>
 <script type="text/javascript">
    document.getElementById('jsdetect').className = 'js-on';
 </script>

</html>

, - , Javascript .

+1

// , JavaScript .

<noscript>
   // Do Something
</noscript>
0

Another option that is open to you, and not with the obvious noscript tag, is to use JavaScript to remove the cookie, and then check that cookie and deliver the content accordingly. javascript ver vs non redirect or span

just thought i would drop it there.

0
source

Source: https://habr.com/ru/post/1747787/


All Articles