Hello,
So I found the hook w3tc_lazyload_can_process which does this, but I came to the conclusion that if the page is cached then especially the lazy load always needs to be off since if the cahced page was loaded from Chrome then that lazyload will always be there independent of which browser loads the cached page.
So since in my case I have the cache for logged out users only, here’s my solution:
function disable_lazy_loading_on_safari( $can_process ) {
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
$browser_name = '';
if(strpos($HTTP_USER_AGENT, 'MSIE') !== false)
$browser_name = 'Internet explorer';
elseif(strpos($HTTP_USER_AGENT, 'Trident') !== false)
$browser_name = 'Internet explorer';
elseif(strpos($HTTP_USER_AGENT, 'Firefox') !== false)
$browser_name = 'Mozilla Firefox';
elseif(strpos($HTTP_USER_AGENT, 'Chrome') !== false)
$browser_name = 'Google Chrome';
elseif(strpos($HTTP_USER_AGENT, 'Opera Mini') !== false)
$browser_name = "Opera Mini";
elseif(strpos($HTTP_USER_AGENT, 'Opera') !== false)
$browser_name = "Opera";
elseif(strpos($HTTP_USER_AGENT, 'Safari') !== false)
$browser_name = "Safari";
else
$browser_name = 'Other';
if ( !is_user_logged_in() || $browser_name === 'Safari' || $browser_name == 'Internet explorer') {
$can_process['enabled'] = false;
}
return $can_process;
}
add_filter( 'w3tc_lazyload_can_process', 'disable_lazy_loading_on_safari' );
Thank you.