Skip to content

Commit 419bb08

Browse files
Fix for iOS webview matching.
1 parent dc07788 commit 419bb08

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

lib/express-useragent.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,10 +1072,21 @@
10721072
* boolean flag `isiOSStandalone`, `isiOSUiwebview` and `isAndroidWebview` will be set as side effect.
10731073
*/
10741074
UserAgent.prototype.testWebview = function() {
1075-
if (this.Agent.os === 'iOS' && isBrowser) {
1076-
if (window.navigator.standalone && !this.Agent.isSafari) {
1075+
var isiOS = ['iOS', 'OS X'].indexOf(this.Agent.os) !== -1 || (this.Agent.isiPad || this.Agent.isiPod || this.Agent.isiPhone);
1076+
var isStandaloneBrowser =
1077+
this.Agent.isYaBrowser ||
1078+
this.Agent.isOpera ||
1079+
this.Agent.isIE ||
1080+
this.Agent.isEdge ||
1081+
this.Agent.isSafari ||
1082+
this.Agent.isFirefox ||
1083+
this.Agent.isChrome ||
1084+
this.Agent.isUC;
1085+
1086+
if (isiOS && isBrowser) {
1087+
if (window.navigator.standalone && !isStandaloneBrowser) {
10771088
this.Agent.isiOSStandalone = true;
1078-
} else if (!window.navigator.standalone && !this.Agent.isSafari) {
1089+
} else if (!window.navigator.standalone && !isStandaloneBrowser) {
10791090
this.Agent.isiOSUiwebview = true;
10801091
}
10811092
} else if (this.Agent.isAndroid) {

0 commit comments

Comments
 (0)