redirect to another page if javascript is disabled
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>
Redirect if no JavaScript
If you need to redirect, make the PHP version the default and redirect if javascript is enabled. I would avoid this though and not have a redirect at all and just display on the same page based on whether javascript is enabled/disabled. You can show the javascript items if enabled. I usually have a class name no-script in the body of the page and remove it if javascript is enabled, you can then use CSS to target what to display based on that one tag.
How to redirect if javaScript is disabled?
Make the no-JavaScript version of the site the default. Include a small script in there to redirect to the scripted site.
Or, abandon the use of a redirect entirely and go with Progressive Enhancement
Noscript to redirect (I need to redirect)
You may try this:-
<noscript>
<a href="">Click here to continue</a>
</noscript>
or
<noscript>
<meta http-equiv="refresh" content="0;url=noscript.html">
</noscript>
Related Topics
How to Compile Ruby to JavaScript
Why Does JavaScript's Eval Need Parentheses to Eval JSON Data
How to Add/Remove a Class in JavaScript
Difference Between Date(Datestring) and New Date(Datestring)
The Definitive Best Way to Preload Images Using JavaScript/Jquery
Encrypting Data with Ruby Decrypting with Node
Setting a Variable to Get Return from Call Back Function Using Promise
iOS JavaScript Workers High CPU After Terminate()
Filter Array of Objects by Multiple Properties and Values
Ruby on Rails 4 JavaScript Not Executed
Where Do the Parameters in a JavaScript Callback Function Come From
How Does JavaScript Determine the Number of Digits to Produce When Formatting Floating-Point Values
How to Split Comma Separated String Using JavaScript
JavaScript with Embedded Ruby: How to Safely Assign a Ruby Value to a JavaScript Variable
How to Execute Array of Promises in Sequential Order
How to Wait in Node.Js (Javascript)? L Need to Pause for a Period of Time