Skip to content

chore: drop dead IE11 MSStream check in iPadOS detection#160

Merged
puckey merged 1 commit intomasterfrom
chore/drop-ie11-msstream
Apr 14, 2026
Merged

chore: drop dead IE11 MSStream check in iPadOS detection#160
puckey merged 1 commit intomasterfrom
chore/drop-ie11-msstream

Conversation

@puckey
Copy link
Copy Markdown
Collaborator

@puckey puckey commented Apr 14, 2026

Summary

The !window.MSStream clause in the iPadOS detection branch was imported from a circa-2013 Stack Overflow snippet that used it to exclude Internet Explorer on Windows Phone from being detected as iOS. It was never reachable under the `platform === 'MacIntel'` branch — IE never ran on macOS — so the guard was dead the day it was added. IE itself has been EOL since June 2022.

Removing it also drops the `@ts-expect-error` comment it justified (since `window.MSStream` isn't in the DOM lib types).

Bonus: comment upgrades

  • One-line note on why `navigator.platform` (deprecated per MDN) is still in use here: `navigator.userAgentData.platform` is Chromium-only and doesn't expose the iPadOS-as-MacIntel masquerade.
  • Acknowledge a known forward-looking limitation: if Apple ever ships a touchscreen Mac, it will also match `MacIntel + maxTouchPoints > 0` and be misclassified as iPad here. No such device exists today; revisit when/if it ships. (`navigator.standalone` was considered as a Touch-Mac-proof alternative, but I verified on macOS Safari today that `typeof navigator.standalone === 'boolean'` — Apple extended it to macOS at some point, so it can't be used to discriminate Mac from iPad anymore.)

Diff

-  // Workaround for ipadOS, force detection as tablet
+  // Workaround for ipadOS, force detection as tablet. `platform` is
+  // deprecated but remains the only reliable way to distinguish iPadOS
+  // desktop-mode (MacIntel + touch) from a real Mac on Safari/Firefox.
+  // Known limitation: if Apple ever ships a touch-screen Mac, it will
+  // also match `MacIntel + maxTouchPoints > 0` and be misclassified as
+  // iPad here. No such device exists today; revisit when/if it ships.
   // SEE: https://github.com/lancedikson/bowser/issues/329
   // SEE: https://stackoverflow.com/questions/58019463/how-to-detect-device-name-in-safari-on-ios-13-while-it-doesnt-show-the-correct
   const isIpad =
-    platform === 'iPad' ||
-    // @ts-expect-error window.MSStream is non standard
-    (platform === 'MacIntel' && maxTouchPoints > 0 && !window.MSStream);
+    platform === 'iPad' || (platform === 'MacIntel' && maxTouchPoints > 0);

Test plan

  • `pnpm test` — all tests pass
  • `pnpm lint` passes
  • `pnpm format:check` passes
  • `pnpm build` succeeds

`!window.MSStream` was imported from a circa-2013 Stack Overflow snippet
that used it to exclude Internet Explorer on Windows Phone from being
detected as iOS. It was never reachable under the `MacIntel` branch —
IE never ran on macOS — so the guard was dead the day it was written.
IE itself has been EOL since June 2022.

Removing it also drops the `@ts-expect-error` it justified.

Also inlines a brief note on why `navigator.platform` (deprecated on
MDN) is still used here: `navigator.userAgentData.platform` is
Chromium-only and doesn't expose the iPadOS-as-MacIntel masquerade.
@puckey puckey merged commit 4234e83 into master Apr 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant