]> git.proxmox.com Git - mirror_xterm.js.git/blame - src/utils/Browser.ts
Fix SelectionManager initializing
[mirror_xterm.js.git] / src / utils / Browser.ts
CommitLineData
3e1a6071
DI
1/**
2 * Attributes and methods to help with identifying the current browser and platform.
3 * @module xterm/utils/Browser
4 * @license MIT
5 */
6
7import { contains } from './Generic';
8
9const isNode = (typeof navigator === 'undefined') ? true : false;
10const userAgent = (isNode) ? 'node' : navigator.userAgent;
11const platform = (isNode) ? 'node' : navigator.platform;
12
13export const isFirefox = !!~userAgent.indexOf('Firefox');
14export const isMSIE = !!~userAgent.indexOf('MSIE') || !!~userAgent.indexOf('Trident');
15
16// Find the users platform. We use this to interpret the meta key
17// and ISO third level shifts.
18// http://stackoverflow.com/q/19877924/577598
19export const isMac = contains(['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], platform);
20export const isIpad = platform === 'iPad';
21export const isIphone = platform === 'iPhone';
22export const isMSWindows = contains(['Windows', 'Win16', 'Win32', 'WinCE'], platform);
dc165175 23export const isLinux = platform.indexOf('Linux') >= 0;