Browsers with Javascript disabled

Question:
What is the best practice for handling users who have disabled JS in their browsers? I’ve inherited a site with a lot of Velo frontend code that obviously doesn’t work for those users. I’d be happy to just be able to catch these folks (a minority of our users) and throw up a message to them BUT I also don’t want to intrude on the majority of users who have JS enabled.

Product:

Velo frontend

What have you already tried:

My best thought was to display the message by default and then have a local event like onViewPortEnter hide it. No JS, message stays. JS, message is hidden. But the flaw here is the message is displayed for everyone, even if only for a fraction of a second.

  1. First you will have to determine if on the USER’s webpage the JS-functionality is enabled or disabled.

This for you can implement a HTML-Component with some kind of the following code…

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript Detection</title>
    <script>
        // Set a global variable to true indicating that JavaScript is enabled
        var isJavaScriptEnabled = true;
    </script>
    <noscript>
        <!-- If JavaScript is disabled, set the global variable to false -->
        <style> .js-disabled-message { display: block; } </style>
    </noscript>
</head>
<body>
    <p class="js-disabled-message">JavaScript is required for this website to function properly.</p>
    <!-- Your website content goes here -->
    
    <!-- Example of using the JavaScript detection -->
    <script>
        if (!isJavaScriptEnabled) {
            // JavaScript is disabled, display a message or take alternative action
            document.querySelector('.js-disabled-message').style.display = 'block';
        }
    </script>
</body>
</html>
  1. Then you send the results back to your Wix-Page —> and showing the related INFO for the current USER (regarding the reult).

Appreciate the answer but I’m confused. I’m in a purely-Wix environment and so don’t see how/where to integrate an HTML webpage in the flow to do the detection.

If I could start with a pure-HTML page, well, that’d sure solve things.

  1. First → ACTIVATE → DEV-MODE in your Wix-Editor.
  2. Add a → HTML-Component to your wished page.
  3. Add the code into the HTML-Component.
  4. Publish website and check it on your live-site.

Unfortunately the HTML component will only render if JS is enabled.

If so—> paste the code directly into the HEADER or BODY on Wix-website.
You will find it in your DASHBOARD → SETTINGS or similar.