aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/utils/browser.js
blob: 6b5e768a7e3a9dfc70f14aa35b8bf5afe1838ef8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// ==========================================================================
// Browser sniffing
// Unfortunately, due to mixed support, UA sniffing is required
// ==========================================================================

const browser = {
  isIE: Boolean(window.document.documentMode),
  isEdge: window.navigator.userAgent.includes('Edge'),
  isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent),
  isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),
  isIos:
    (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1) ||
    /(iPad|iPhone|iPod)/gi.test(navigator.platform),
};

export default browser;