PageSourceSearch

https://webinare-vhs.de/_assets/6a3990347b39dd3a85c572552f4b5a56/JavaScript/browserdetect.js?1770625428

js webinare-vhs.de collected 2026-10-09 03:47:31 UTC 1,970 bytes, 60 lines download raw bytes

1const minOSVersion = {
2    iOS: "12.0.0",
3};
4
5document.addEventListener("DOMContentLoaded", function() {
6    const notAllowedEngines = [
7        'Trident'
8    ];
9
10    const parser = new UAParser();
11    const result = parser.getResult();
12
13    const div = document.getElementById("outdated_browser");
14    const webCompEl = document.getElementById("web_comp_app-root");
15
16    if(webCompEl){
17        if (!result || result.engine.name === undefined || notAllowedEngines.includes(result.engine.name) || !checkOSAndVersion(result, 'iOS')) {
18            console.warn("Browser NOT supported", result.engine);
19
20            const browserIdElem = document.getElementById("browser_id");
21            browserIdElem.appendChild(
22                document.createTextNode(result.engine.name)
23            );
24
25            const browserVersionElem = document.getElementById("browser_version");
26            browserVersionElem.appendChild(
27                document.createTextNode(result.engine.version)
28            );
29
30            const userAgent = document.getElementById("user_agent");
31            userAgent.appendChild(
32                document.createTextNode(result.ua)
33            );
34
35            div.classList.remove('d-none');
36        } else {
37            webCompEl.classList.remove('d-none');
38            console.log("Browser supported", result.engine);
39        }
40    }
41});
42
43function checkOSAndVersion(data, key) {
44    const isOS = data.os.name === key;
45    const version = data.os.version ?? null;
46    return !isOS || (version && versionCompare(version, minOSVersion[key]) >= 0);
47}
48
49function versionCompare(v1, v2) {
50  const v1Parts = v1.split('.').map(Number);
51  const v2Parts = v2.split('.').map(Number);
52
53  for (let i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
54    const num1 = v1Parts[i] || 0;
55    const num2 = v2Parts[i] || 0;
56    if (num1 > num2) return 1;
57    if (num1 < num2) return -1;
58  }
59  return 0;
60}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.