From 2b80ea3105bab49c4325bb22d38ac59c35b9644c Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 12 Mar 2015 23:03:34 +0800 Subject: [PATCH] Add bowser test function. --- src/bowser.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/bowser.js b/src/bowser.js index 6547b0d..1c59e29 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -222,6 +222,17 @@ var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent : '') + bowser.test = function (browserList) { + for (var i = 0; i < browserList.length; ++i) { + var browserItem = browserList[i]; + if (typeof browserItem=== 'string') { + if (browserItem in bowser) { + return true; + } + } + } + return false; + } /* * Set our detect method to the main bowser object so we can