Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D0508200C2A for ; Wed, 1 Mar 2017 09:10:51 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id CED31160B78; Wed, 1 Mar 2017 08:10:51 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1E3DF160B5E for ; Wed, 1 Mar 2017 09:10:50 +0100 (CET) Received: (qmail 42222 invoked by uid 500); 1 Mar 2017 08:10:50 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 42207 invoked by uid 99); 1 Mar 2017 08:10:50 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Mar 2017 08:10:50 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 9289EC01B7 for ; Wed, 1 Mar 2017 08:10:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.451 X-Spam-Level: * X-Spam-Status: No, score=1.451 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id QED3xNM4_a1V for ; Wed, 1 Mar 2017 08:10:48 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 99E3F618A4 for ; Wed, 1 Mar 2017 08:10:48 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 1E52FE0502 for ; Wed, 1 Mar 2017 08:10:47 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 31DBD2415A for ; Wed, 1 Mar 2017 08:10:46 +0000 (UTC) Date: Wed, 1 Mar 2017 08:10:46 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-12105) window.device.model returns "Chrome" instead of "Edge" when using MS Edge MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 01 Mar 2017 08:10:52 -0000 [ https://issues.apache.org/jira/browse/CB-12105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15889723#comment-15889723 ] ASF subversion and git services commented on CB-12105: ------------------------------------------------------ Commit 4472603a42859084f1a151ebc3676421d33547a7 in cordova-plugin-device's branch refs/heads/master from [~alsorokin] [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-device.git;h=4472603 ] CB-12105 (browser) Properly detect Edge > window.device.model returns "Chrome" instead of "Edge" when using MS Edge > ------------------------------------------------------------------------- > > Key: CB-12105 > URL: https://issues.apache.org/jira/browse/CB-12105 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin Device > Affects Versions: 6.3.2 > Reporter: Mark Veenstra > Assignee: Alexander Sorokin > Priority: Critical > > When building for platform browser the {{cordova-plugin-device}} (v1.3.2) returns "Chrome" instead of "Edge" when requesting {{window.device.model}} on an Edge browser. > In the {{DeviceProxy.js}} the following code is there: https://github.com/apache/cordova-plugin-device/blob/master/src/browser/DeviceProxy.js#L40 > {code} > function getBrowserInfo(getModel) { > var userAgent = navigator.userAgent; > var returnVal = ''; > var offset; > if ((offset = userAgent.indexOf('Chrome')) !== -1) { > returnVal = (getModel) ? 'Chrome' : userAgent.substring(offset + 7); > } else if ((offset = userAgent.indexOf('Safari')) !== -1) { > if (getModel) { > returnVal = 'Safari'; > } else { > returnVal = userAgent.substring(offset + 7); > if ((offset = userAgent.indexOf('Version')) !== -1) { > returnVal = userAgent.substring(offset + 8); > } > } > } else if ((offset = userAgent.indexOf('Firefox')) !== -1) { > returnVal = (getModel) ? 'Firefox' : userAgent.substring(offset + 8); > } else if ((offset = userAgent.indexOf('MSIE')) !== -1) { > returnVal = (getModel) ? 'MSIE' : userAgent.substring(offset + 5); > } else if ((offset = userAgent.indexOf('Trident')) !== -1) { > returnVal = (getModel) ? 'MSIE' : '11'; > } > if ((offset = returnVal.indexOf(';')) !== -1 || (offset = returnVal.indexOf(' ')) !== -1) { > returnVal = returnVal.substring(0, offset); > } > return returnVal; > } > {code} > The code above returns model Chrome as soon as it is in the userAgent string. MS Edge provides the following userAgent string: {{Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393}} > So it seems we should be checking first if "Edge" is part of the userAgent. If so the browser would be Edge. -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org