How to redirect if JavaScript is not enabled in a browser?

To redirect if JavaScript is not enabled in the web browser, add a script to the <noscript> tag. Let us say you need to redirect to index.php if JavaScript is not enabled. 


Here’s how you can do this:

<!DOCTYPE html>
      <title>HTML noscript Tag</title>
            document.write("Hello JavaScript!")
         <meta http-equiv="refresh" content="0.0;url=nojs/index.php”>

Above, we first use CSS style, since we do not want the actual page to be visible if JavaScript is disabled in the web browser.

Updated on: 03-Jan-2020


Kickstart Your Career

Get certified by completing the course

Get Started