in-app browser issue

Reference:

  1. https://blog.user.today/inapp-browser-webview-problem/
  2. 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:

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;
	}
}