fix(platform-browser): IEMobile is badly detected when testing (#10382)

This commit is contained in:
Marc Laval 2016-07-29 19:05:12 +02:00 committed by Victor Berchet
parent f0bd528d77
commit 43c71ae103
2 changed files with 18 additions and 3 deletions

View File

@ -85,6 +85,18 @@ export function main() {
isSlow: true, isSlow: true,
isChromeDesktop: false isChromeDesktop: false
}, },
{
name: 'IEMobile',
ua: 'Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537',
isFirefox: false,
isAndroid: false,
isEdge: false,
isIE: true,
isWebkit: false,
isIOS7: false,
isSlow: true,
isChromeDesktop: false
},
{ {
name: 'Edge', name: 'Edge',
ua: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136', ua: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136',

View File

@ -28,7 +28,8 @@ export class BrowserDetection {
get isAndroid(): boolean { get isAndroid(): boolean {
return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 && return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 &&
this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1; this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1 &&
this._ua.indexOf('IEMobile') == -1;
} }
get isEdge(): boolean { return this._ua.indexOf('Edge') > -1; } get isEdge(): boolean { return this._ua.indexOf('Edge') > -1; }
@ -36,11 +37,13 @@ export class BrowserDetection {
get isIE(): boolean { return this._ua.indexOf('Trident') > -1; } get isIE(): boolean { return this._ua.indexOf('Trident') > -1; }
get isWebkit(): boolean { get isWebkit(): boolean {
return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1; return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1 &&
this._ua.indexOf('IEMobile') == -1;
} }
get isIOS7(): boolean { get isIOS7(): boolean {
return this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1; return (this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1) &&
this._ua.indexOf('IEMobile') == -1;
} }
get isSlow(): boolean { return this.isAndroid || this.isIE || this.isIOS7; } get isSlow(): boolean { return this.isAndroid || this.isIE || this.isIOS7; }