Check Whether Javascript is Enabled on Browser Using HTML5 - Kvcodes
X

Congrats, You are Subscribed to Receive Updates.

Check Whether Javascript is Enabled on Browser Using HTML5


Many circumstance, as a developer we need to use JavaScript to perform several operations ,Especially AJAX is one of a needy thing. For security reasons we need to use js to avoid risk.  But users have a option on their browser to disable JavaScript to avoid such a things. On the situation we need to hide our works from user view.

Here I just experienced to check whether js is enabled or not.  In our example, I use two html files to check it.

Index.html.

no-js.html

no-js

Our index.html  is the default file, which requires js to perform several operations,  so add a simple html coding to check whether js enabled, If its enabled stay on the page, else redirect to no-js.html and code for index.html

<html>
<head>
<title> Check whether js enabled or not- Kvcodes </title>
<noscript><meta http-equiv="refresh" content="1;url=no-js.html"></noscript>

.....

here your index codings go on.

Than,  the idex.html will redirect the user to no-js.html page, if they disabled the js.  now open your no-js.html file to check if the user re- enable js than redirect to index.htl page.

<html>
<head> <title> No javascript Please enable js on your browser </title>
<script src="/path/to/jquery/jquery-latest.js" > </script> 
<script> 
$(document).ready( function() {
window.location = "omindata.html";
});
</script>
</head>

<body align="center">
<div style="position: relative; " >
<img src="no-javascript.jpg" align="center" > 
<h3> Please Enable JavaScript on your Browser and Refresh(F5) it!. </h3>
</div> 
</body>

</html>

Thats, it, it will work on IE(8,9,10) , Chrome, Firefox, and Opera.

 

 

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, OpenCart Theme Development, PHP, HTML, CSS, jQuery, Bootstrap development and content SEO.

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar

Subscribe E-mail Updates

Congrats, You are Subscribed to Receive Updates.

Advertisement

Category Posts