Skip to content

Commit

Permalink
Fix for iOS webview matching.
Browse files Browse the repository at this point in the history
  • Loading branch information
VashurkinAnton committed Feb 11, 2021
1 parent dc07788 commit 419bb08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions lib/express-useragent.js
Original file line number Diff line number Diff line change
Expand Up @@ -1072,10 +1072,21 @@
* boolean flag `isiOSStandalone`, `isiOSUiwebview` and `isAndroidWebview` will be set as side effect.
*/
UserAgent.prototype.testWebview = function() {
if (this.Agent.os === 'iOS' && isBrowser) {
if (window.navigator.standalone && !this.Agent.isSafari) {
var isiOS = ['iOS', 'OS X'].indexOf(this.Agent.os) !== -1 || (this.Agent.isiPad || this.Agent.isiPod || this.Agent.isiPhone);
var isStandaloneBrowser =
this.Agent.isYaBrowser ||
this.Agent.isOpera ||
this.Agent.isIE ||
this.Agent.isEdge ||
this.Agent.isSafari ||
this.Agent.isFirefox ||
this.Agent.isChrome ||
this.Agent.isUC;

if (isiOS && isBrowser) {
if (window.navigator.standalone && !isStandaloneBrowser) {
this.Agent.isiOSStandalone = true;
} else if (!window.navigator.standalone && !this.Agent.isSafari) {
} else if (!window.navigator.standalone && !isStandaloneBrowser) {
this.Agent.isiOSUiwebview = true;
}
} else if (this.Agent.isAndroid) {
Expand Down
Loading

0 comments on commit 419bb08

Please sign in to comment.