SQL PHP HTML ASP JavaScript articles and free scripts to download
JavaScript Basics

Redirecting Browser to a page if JavaScript support is not there

If you have developed a page which depends on JavaScript for form validation or for any other purposes then you would be interested in detecting the setting of the client browser and would like to redirect to a different page explaining how to enable or disable JavaScript. Here we will discuss how to check this setting and redirect to a different page accordingly. We can detect this by using noscript tag and if the JavaScript is disabled then the code within this noscript tag will be executed. Here is the code to do that. This code will detect if the script setting is disabled and will redirect to a page explaining how to enable or disable JavaScript. This code will will also redirect the page with meta refresh in 2 seconds.

Demo of javaScript support and redirecting

Here is the code

<html>
<head>
<title>Demo of Checking if JavaScript is enabled in web browser</title>
</head>
<body >
<noscript>
<meta http-equiv="refresh" content="2; URL=enable_javascript.php">
Are you using a browser that doesn't support JavaScript?<br><br>

If your browser does not support JavaScript, you can upgrade to a newer browser<br><br>

If you have disabled JavaScript, you must re-enable JavaScript to use this page. To enable JavaScript:
</noscript>

<br><br>
If you are not seeing any message above this line then you have JavaScript enabled in your browser.
</body>
</html>

In the above code check this line
<meta http-equiv="refresh" content="2; URL=enable_javascript.php">
This line redirects the browser to a different page after 2 seconds. You can change the time duration by changing 2 seconds to any other value.
Google+

Amirreza27-06-2014
Perfect method!

Used on my webiste,It fully works without any errors!

Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

JavaScript Basic functions
Variables
Functions
Detecting Browser type



HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer