File: cookie-consent-basic.html

package info (click to toggle)
webkit2gtk 2.44.2-1~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 367,728 kB
  • sloc: cpp: 2,946,520; javascript: 194,328; ansic: 137,901; python: 45,716; ruby: 18,487; asm: 16,672; perl: 16,476; xml: 4,376; yacc: 2,350; sh: 2,127; java: 1,711; lex: 1,323; pascal: 333; makefile: 323
file content (27 lines) | stat: -rw-r--r-- 683 bytes parent folder | download | duplicates (14)
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
<!DOCTYPE html>
<html>
<meta charset="utf8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<head>
<script>
addEventListener("DOMContentLoaded", async () => {
    const output = document.getElementById("output");
    if (!navigator.requestCookieConsent) {
        output.textContent = "not enabled";
        return;
    }

    try {
        let consent = await navigator.requestCookieConsent();
        output.textContent = `returned: ${consent}`;
    } catch (e) {
        output.textContent = `threw exception: ${e}`;
    }
});
</script>
</head>
<body>
<pre>navigator.requestCookieConsent()</pre>
<pre>↪&nbsp;<code id="output"></code></pre>
</body>
</html>