Javascript Redirection

The redirecting is a good way to check for the presence of JavaScript and in this case also for the version of JavaScript the user has.

window.location=”js_test_true.html”) resets the location property of the current browser window. In this case it sets it to “js_test_true.html”.

If the user doesn’t have the version of JavaScript required, which is JavaScript 1.1 in order to redirect, or JavaScript is turned off, it will display “Your browser doesn’t support JavaScript, it’s turned of in your browsers preferences or you don’t the latest version of JavaScript.”.

To specify the minimum requirement you just have to set language in the <script> tag as you can see in the Script Listening above. You can have different language versions in different scripts on your page, but there’s no way to say that for example our redirection script should only run with JavaScript 1.1, it will run with JavaScript 1.1 and greater.

Redirection Example:

<html>
<head>
<title>JavaScript Redirection</title>
<script language=javascript1.1>
<!-- Hide Script
	window.location="js_test_true.html")
//End Hide Script-->
</script>
</head>
<body>
  Your browser doesn't support JavaScript,
  it's turned off in your browsers preferences
  or you don't the latest version of JavaScript.
</body>
</html>