EN
HTML - detect if JavaScript is disabled
4 points
In this short article, we would like to show how to detect if JavaScript is disabled / blocked.
Quick solution:
xxxxxxxxxx
1
2
<html>
3
<body>
4
<noscript>
5
If you see this text it means the JavaScript is disabled.
6
</noscript>
7
</body>
8
</html>
Where
<noscript>
content will be displayed only if JavaScript is disabled or not available.
Screenshot:

In this section, you can find message displayed on Dirask when JavaScript is disabled.
xxxxxxxxxx
1
2
<html>
3
<head>
4
<style>
5
6
body {
7
font-family: system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
8
}
9
10
div.message-block {
11
padding: 14px 20px;
12
border: 1px solid #d4bc08;
13
border-radius: 7px;
14
background: #f7df1d;
15
text-align: center;
16
line-height: 36px;
17
color: #212121;
18
}
19
20
div.message-title {
21
font-size: 18px;
22
}
23
24
span.message-marker {
25
font-weight: 500;
26
}
27
28
div.message-description {
29
font-size: 14px;
30
}
31
32
</style>
33
</head>
34
<body>
35
<noscript>
36
<div class="message-block">
37
<div class="message-title"><span class="message-marker">JavaScript</span> is disabled!</div>
38
<div class="message-description">to use the site features enable it.</div>
39
</div>
40
</noscript>
41
</body>
42
</html>
Note: to see the effect, copy source code into your website and disable JavaScript.
Screenshot:
