Skip to content

Instantly share code, notes, and snippets.

@jpescada
Created August 21, 2020 11:32
Show Gist options
  • Save jpescada/aaa214b7b32b23df3a722edf703cf201 to your computer and use it in GitHub Desktop.
Save jpescada/aaa214b7b32b23df3a722edf703cf201 to your computer and use it in GitHub Desktop.
Detect WebKit browser on (mobile) iOS device
// Based on https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
const isWebkit = (): boolean => {
const UA = navigator.userAgent
return /\b(iPad|iPhone|iPod)\b/.test(UA) && /WebKit/.test(UA) &&
!/Edge/.test(UA) && !window.MSStream
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment