Skip to content

Commit

Permalink
fixed android google chrome in app browser
Browse files Browse the repository at this point in the history
  • Loading branch information
roadmanfong authored and yutin1987 committed Jun 16, 2022
1 parent 2c488a9 commit dade9ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/__test__/inapp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ const MOBILE = {
PUFFIN: [
'Mozilla/5.0 (Linux; Android 7.1.2; Pixel Build/N2G47E; zh-tw) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Puffin/6.0.9.15863AP',
],
CHROME: [
"Mozilla/5.0 (Linux; Android 12; Pixel 4 XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Mobile Safari/537.36",
],
},
HTC: {
FACEBOOK: [],
Expand Down
2 changes: 1 addition & 1 deletion src/inapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class InApp {
const rules = [
'WebView',
'(iPhone|iPod|iPad)(?!.*Safari\/)',
'Android.*(wv|\.0\.0\.0)',
'Android.*(wv)',

This comment has been minimized.

Copy link
@brunofin

brunofin Jan 16, 2024

this makes Android Chrome be detected as an in-app browser. See #52

This comment has been minimized.

Copy link
@shalanah

shalanah Feb 4, 2024

I use this instead: 'Android.*(wv|/\\d\\d.0.0.0)',
For my dependencies I use this as well: "detect-inapp": "github:shalanah/detect-inapp#shalanah-build"

];
const regex = new RegExp(`(${rules.join('|')})`, 'ig');
return Boolean(this.ua.match(regex));
Expand Down

0 comments on commit dade9ee

Please sign in to comment.