PageSourceSearch

https://venue.ink/assets/outdated-browser.500dabec.js

js venue.ink collected 2026-10-01 12:10:54 UTC 4,071 bytes, 122 lines download raw bytes

1/**
2 * NOTE: Comments in this file will be publicly visible
3 */
4
5// Per https://tailwindcss.com/docs/compatibility
6const MINIMUM_BROWSER_VERSIONS = {
7  chrome: 99, // Tailwind v4 requires 111+ but Venue loads ok (but degraded) on 99+
8  safari: 15.4, // in our testing we found of 15.4 to be decent enough. Anything less is too broken
9  firefox: 97, // Tailwind v4 requires 128+ but Venue loads ok (but degraded) on 97+
10}
11
12const LOCAL_STORAGE_OVERRIDE_KEY = "outdated_browser_override"
13
14const parser = new UAParser()
15const result = parser.getResult()
16
17const browserVersion = parseFloat(result.browser.version || "0")
18
19const isSafari =
20  result.browser.name === "Mobile Safari" || result.browser.name === "Safari"
21const isChrome =
22  result.browser.name === "Chrome" || result.browser.name === "Mobile Chrome"
23const isFirefox =
24  result.browser.name === "Firefox" || result.browser.name === "Mobile Firefox"
25
26const tooOld =
27  (isSafari && browserVersion < MINIMUM_BROWSER_VERSIONS.safari) ||
28  (isChrome && browserVersion < MINIMUM_BROWSER_VERSIONS.chrome) ||
29  (isFirefox && browserVersion < MINIMUM_BROWSER_VERSIONS.firefox)
30
31function setOverrideAndRedirect() {
32  console.log("setting override in localStorage and redirecting to /me")
33  // posthog may not be available in all contexts, so we wrap it in a try-catch
34  try {
35    if (typeof posthog !== "undefined") {
36      posthog.capture(
37        "outdated_browser_override_button_clicked",
38        JSON.parse(JSON.stringify(result)),
39      )
40    }
41  } catch (error) {
42    console.error("Error capturing event with PostHog:", error)
43  }
44  try {
45    localStorage.setItem(LOCAL_STORAGE_OVERRIDE_KEY, "true")
46  } catch (error) {
47    console.error("Error setting localStorage item:", error)
48  }
49  window.location.href = "/me"
50}
51
52function isOverride() {
53  try {
54    return localStorage.getItem(LOCAL_STORAGE_OVERRIDE_KEY) === "true"
55  } catch (error) {
56    console.error("Error accessing localStorage:", error)
57    return false
58  }
59}
60
61// Updates the DOM to show instructions based on the user's device and OS
62function showInstructions() {
63  const iosElements = document.querySelectorAll(".ios")
64  const nonIOSElements = document.querySelectorAll(".non-ios")
65  const deviceName = document.querySelectorAll(".device-name")
66  const osName = document.querySelectorAll(".os-name")
67  const overrideButton = document.getElementById("override-button")
68
69  if (overrideButton) {
70    overrideButton.addEventListener("click", setOverrideAndRedirect)
71  } else {
72    console.warn("Override button not found in DOM")
73  }
74
75  if (result.os.name === "iOS" || result.os.name === "macOS") {
76    document.title = "Please update your " + result.os.name + " - Venue.ink"
77    iosElements.forEach(el => el.classList.remove("hidden"))
78    nonIOSElements.forEach(el => el.classList.add("hidden"))
79    let device =
80      (result.device.model === "Macintosh" ? "device" : result.device.model) ||
81      "device"
82    deviceName.forEach(el => (el.textContent = device))
83    osName.forEach(el => (el.textContent = result.os.name || "OS"))
84  } else {
85    nonIOSElements.forEach(el => el.classList.remove("hidden"))
86    iosElements.forEach(el => el.classList.add("hidden"))
87    deviceName.forEach(el => (el.textContent = "device"))
88  }
89}
90
91window.OutdatedBrowser = {
92  MINIMUM_BROWSER_VERSIONS: MINIMUM_BROWSER_VERSIONS,
93  isOutdated: tooOld,
94  parsedUA: result,
95  isOverride: isOverride,
96  redirectIfTooOld: function () {
97    if (tooOld) {
98      if (isOverride()) {
99        console.log(
100          "Browser is outdated, but user has overridden the outdated browser page",
101          result,
102        )
103      } else {
104        window.location.href = "/outdated-browser.html"
105      }
106      return
107    }
108  },
109  redirectIfTooNew: function () {
110    if (!tooOld) {
111      window.location.href = "/me"
112      return
113    } else if (isOverride()) {
114      console.log(
115        "Browser is outdated, but user has overridden the outdated browser page. Redirecting away",
116        result,
117      )
118      window.location.href = "/me"
119    }
120  },
121  showInstructions: showInstructions,
122}

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.