-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_element_supports_sample.html
41 lines (39 loc) · 1.16 KB
/
script_element_supports_sample.html
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
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>HTMLScriptElement.supports(type) method sample</title>
</head>
<body>
<h1>HTMLScriptElement.supports(type) method sample</h1>
<script>
(() => {
function log(text) {
const div = document.createElement('div');
div.appendChild(document.createTextNode(text));
document.body.appendChild(div);
}
if (!('supports' in HTMLScriptElement)) {
log('Your browser doesn\'t support HTMLScriptElement.supports() method.');
log('Please open this page with Chrome (>=95.0.4635.1) after enabling ' +
'chrome://flags/#enable-experimental-web-platform-features flag or ' +
'adding "--enable-blink-features=ScriptElementSupports" command-line ' +
'switch.');
return;
}
log('Your browser supports HTMLScriptElement.supports() method.');
const list = [
'classic',
'module',
'importmap',
'speculationrules'];
for (let type of list) {
if (HTMLScriptElement.supports(type)) {
log('Your browser supports "' + type + '" type.');
} else {
log('Your browser doesn\'t support "' + type + '" type.');
}
}
})();
</script>
</body>