Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

redirect to another page if javascript is disabled [duplicate]

i have a alot of functionality implemented through javascript if at any stage the javascript is disabled he should be redirected to another page. mentioning him to enable the javascript and then proceed. and this functionality should be cross browser compatable Regard,

like image 939
Shah Avatar asked Dec 02 '11 11:12

Shah


1 Answers

Use <noscript> tag to check whether JavaScript is enabled or not.<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.google.com/"> will redirect it to the specified url.Here in this example it will redirect to the google.

Here is an example.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>How To Detect If User Javascript Is Enabled</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    .style1 {
    color: #FF0000;
    font-weight: bold;
    }
    -->
    </style>
    </head>
    <body>
    <p>The Purpose of this script is to show if you have javascript enabled in your browser.</p>
    <p class="style1">
    <script type="text/javascript">
    document.write('Javascript is enabled');
    </script>
    <noscript>
    Javascript is disabled.
    <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.google.com/"> 
     </noscript>
    </p>
  </p>
    </body>
    </html>
like image 71
Rohan Patil Avatar answered Nov 15 '22 15:11

Rohan Patil