From 4d3a9a97c5dabf77f92180e8061334a44ea1da60 Mon Sep 17 00:00:00 2001 From: Thorsten Bux Date: Fri, 22 Dec 2017 17:42:46 +1300 Subject: [PATCH] added phoneType function --- mobile-detect.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mobile-detect.js b/mobile-detect.js index 697f25b..a0bdb94 100644 --- a/mobile-detect.js +++ b/mobile-detect.js @@ -745,6 +745,16 @@ define(function () { return this._cache.phone; }, + /** + * Only working on Webkit! And only tested on Android + * If we got the phone from the above function the string between phone and the 'Build' number returns the phone type + */ + phoneType: function() { + if(this.version('Webkit') && this.os() === 'AndroidOS') { + return this.ua.substring(this.ua.indexOf(this.phone()), this.ua.indexOf('Build') -1); + } + }, + /** * Returns the detected tablet type/family string or null. *