]> git.proxmox.com Git - mirror_xterm.js.git/blob - src/utils/Browser.ts
Merge pull request #810 from Tyriar/809_onSingleClick_null_check
[mirror_xterm.js.git] / src / utils / Browser.ts
1 /**
2 * Attributes and methods to help with identifying the current browser and platform.
3 * @module xterm/utils/Browser
4 * @license MIT
5 */
6
7 import { contains } from './Generic';
8
9 const isNode = (typeof navigator === 'undefined') ? true : false;
10 const userAgent = (isNode) ? 'node' : navigator.userAgent;
11 const platform = (isNode) ? 'node' : navigator.platform;
12
13 export const isFirefox = !!~userAgent.indexOf('Firefox');
14 export 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
19 export const isMac = contains(['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], platform);
20 export const isIpad = platform === 'iPad';
21 export const isIphone = platform === 'iPhone';
22 export const isMSWindows = contains(['Windows', 'Win16', 'Win32', 'WinCE'], platform);
23 export const isLinux = platform.indexOf('Linux') >= 0;