Welcome, guest | Sign In | My Account | Store | Cart

I'm not sure that the following method is universal in all cases to detect is enabled or disabled cookie, javascript and java in user browser at current moment. This is just an example.

JavaScript, 62 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
  <head>
    <title>Is enabled ... ?</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
      table, th, td {
        border: 1px #c0c0c0 solid;
      }
      table {
        width: 50%;
      }
      th, td, p {
        font-family: tahoma;
      }
      th, td {
        text-align: center;
      }
      th {
        background-color: #c0c0c0;
      }
    </style>
  </head>
  <body>
    <table cellpadding="1" cellspacing="0">
      <tr>
        <th>Parameter</th>
        <th>Current state</th>
      </tr>
      <tr>
        <td>Cookie</td>
        <td>
          <script>
            var cookie = navigator.cookieEnabled;
            document.write(cookie ? "Enabled" : "Disabled");
          </script>
          <noscript>X</noscript>
        </td>
      </tr>
      <tr>
        <td>JavaScript</td>
        <td>
          <script>
            document.write("Enabled");
          </script>
          <noscript>Disabled</noscript>
        </td>
      </tr>
      <tr>
        <td>Java</td>
        <td>
          <script>
            var java = navigator.javaEnabled();
            document.write(java ? "Enabled" : "Disabled");
          </script>
          <noscript>X</noscript>
        </td>
      </tr>
    </table>
    <p>Note: X means that parameter cannot be detected without javascript.</p>
  </body>
</html>
Created by greg zakharov on Tue, 19 Mar 2013 (MIT)
JavaScript recipes (69)
greg zakharov's recipes (59)

Required Modules

  • (none specified)

Other Information and Tasks