Friday, 14 November 2014

How to Find the Javascript has enabled or not?

How to Find the Javascript has enabled or not?

For security concern, many users like to disable JavaScript in their web browser, and it raise a big problem in many website which depends on JavaScript to function well. The easy and simple solution is using the HTML “noscript” tag to display different content if JavaScript is disabled.
See following full “noscript” example :
  1. If JavaScript is disabled : Display warning message and hide the entire content with CSS.
  2. If JavaScript is enabled : Fine, do nothing.
<html>
<head></head>
<body>
<h1>noscript example</h1>
<noscript>
        <h3>JavaScript is disabled! Why you want to do so?
        Please enable JavaScript in your web browser!</h3>

        <style type="text/css">
               #main-content { display:none; }
        </style>
</noscript>

<div id="main-content">
        <h3>Welcome, JavaScript user, i like web browser with JavaScript enabled!</h3>
</div>

</body>
</html>


No comments:

Post a Comment