Automattic\Jetpack\Device_Detection
User_Agent_Info::is_chrome_for_iOS()
Detects if the current UA is Chrome for iOS
The User-Agent string in Chrome for iOS is the same as the Mobile Safari User-Agent, with CriOS/<ChromeRevision> instead of Version/<VersionNum>.
- Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3
Method of the class: User_Agent_Info{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = User_Agent_Info::is_chrome_for_iOS();
User_Agent_Info::is_chrome_for_iOS() User Agent Info::is chrome for iOS code WPSCache 1.12.4
public static function is_chrome_for_iOS() { if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { return false; } if ( self::is_iphone_or_ipod( 'iphone-safari' ) === false ) { return false; } $ua = strtolower( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- This is validating. if ( strpos( $ua, 'crios/' ) !== false ) { return true; } else { return false; } }