Reference:
- https://blog.user.today/inapp-browser-webview-problem/
- https://www.wfublog.com/2018/06/mobile-detect-webview-fb-line-in-app.html
Package to detect in-app browser:
https://github.com/f2etw/detect-inapp
Code to detect in-app browser:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
if ( ! function_exists('is_inapp_browser')){ function is_inapp_browser(){ $ua = $_SERVER['HTTP_USER_AGENT']; if($ua == false){ return false; } //Check Facebook $pattern = '/(FBAV|FBBV)/i'; preg_match($pattern, $ua, $result); if($result != false){ return true; } //Check Line $pattern = '/line/i'; preg_match($pattern, $ua, $result); if($result != false){ return true; } return false; } } |