Check Browser JavaScript & Cookies Enable Or Not

23:43

Introduction

In this atricle I want to show how to check browser javascript & cookies enabled or not.

Create Simple Application

Go to Visual Studio > File > New > Web site > Asp.net enpty web site > Enter the name of the Application "Jquery_Check_Disabled_Javascript_Cookies" > Ok
Now take a (Test.html) page and replace the following code:
    <!DOCTYPE html>
<html>
<head>
    <title></title>
 <meta charset="utf-8" />
    <script>
        if (navigator.cookieEnabled)
            alert("Cookies Enabled !!!");
        else
            alert("Cookies Disabled !!!");
    </script>
</head>
<body>
    <noscript>
        <div class="noscriptmsg" style="font-weight:bold;font-size:20px;text-align:center;padding:20px;">
            Please enable javascript in your browser !!!
        </div>
    </noscript>
</body>
</html>

Run The Application (In Google Chrome)

After run the application, if our browser cookies enabled, then it show the below image:


If our browser disabled javascript, then show the following image:


How To Disabled Javascript In Google Chrome

Go to Settings > Click "Show advanced settings…" > In the privacy group, click "content settings..." > Check "Do not allow any site to run Javascript" > Done




Download

You can download application zip file here - 2 KB

Conclusion

If you have any question, please leave a comment.

You Might Also Like

0 comments