Journal3, Webp no support in Safari and LSCache

AndreyPopov

Well-Known Member
Also am no developer. Not sure how I would add the picture element to every place an images is.
if you use Journal3 then you not need to think about where and how "add picture". Journal3 all made by itself.


how Journal scans the header
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.163 Mobile Safari/537.36
these OSes and browsers FULLY support webp and all you need:
- in Journal3 Dashboard System -> Settings -> <site name> -> Performance -> Images -> Compression set to Enable
- in LSCache plugin enable Separate View for Mobile
- in .htaccess uncomment necessary lines


P.S. if you have problem with webp on Apple devices then you must make additional steps.
 
Last edited:

serpent_driver

Well-Known Member
You don't need any device detection if you use HTML picture tag. With picture tag the browser itself checks which image type he supports. At cachecrawler.com I use picture tag and can provide all image types without any detection or cache vary.
 

serpent_driver

Well-Known Member
You can't think as far as I can. :) I don't have to do anything. I don't need any extra programming, no extra function, no device detection and no extra cache and I can still offer all image types from avif to webp to png. Native HTML does the trick.
 

serpent_driver

Well-Known Member
Nothing is perfect, because not OS version matters, but the Safari Version. Safari webp support starts with version > 13, so stop talking nonsense again.
 
Last edited:

AndreyPopov

Well-Known Member

AndreyPopov

Well-Known Member
Again, your device detection doesn't work, because your PHP detection isn't completely sync with cache varies.
are you sure?

I use same checkBrowser function for main lscache checkVary function and for crawler and I use _lscache_vary cookie for that.
rewrite rules in .htaccess only for bots that not accept cookies.



PHP:
    protected function checkBrowser($browser_ua='') {

        if ( $browser_ua == '' ) {
            if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
                $browser_ua = $_SERVER['HTTP_USER_AGENT'];
            } else {
                return FALSE;
            }
        }
       
        if ( (stripos($browser_ua, 'OPR') !== FALSE) || (stripos($browser_ua, 'Opera') !== FALSE) ) {
            return 'chrome';
        }

        if ( (stripos($browser_ua, 'Firefox') !== FALSE) ) {
            return 'chrome';
        }

        if ( (stripos($browser_ua, 'Edg') !== FALSE) ) {
            return 'chrome';
        }

        if ( (stripos($browser_ua, 'YaBrowser') !== FALSE) ) {
            return 'chrome';
        }

        if ( (stripos($browser_ua, 'Chrome') !== FALSE) ) {
            return 'chrome';
        }

        if ( (stripos($browser_ua, 'CriOS') !== FALSE) || (stripos($browser_ua, 'OPT') !== FALSE) || (stripos($browser_ua, 'FxiOS') !== FALSE) || (stripos($browser_ua, 'OpiOS') !== FALSE) ) {
                    if ( (stripos($browser_ua, 'OS 14') !== FALSE) || (stripos($browser_ua, 'OS 15') !== FALSE) || (stripos($browser_ua, 'OS 16') !== FALSE) || (stripos($browser_ua, 'OS 17') !== FALSE) || (stripos($browser_ua, 'OS 18') !== FALSE) ) {
                    return 'chrome';  
                    }
            return 'safari';
        }

        if ( (stripos($browser_ua, 'Safari') !== FALSE) ) {
                    if ( (stripos($browser_ua, 'Version/18') !== FALSE) || (stripos($browser_ua, 'Version/16') !== FALSE) || (stripos($browser_ua, 'Version/17') !== FALSE) || (stripos($browser_ua, 'OS 14') !== FALSE) || (stripos($browser_ua, 'OS 15') !== FALSE) || (stripos($browser_ua, 'OS 16') !== FALSE) || (stripos($browser_ua, 'OS 17') !== FALSE) || (stripos($browser_ua, 'OS 18') !== FALSE) ) {
                    return 'chrome';
                    }
            return 'safari';
        }

        if ( (stripos($browser_ua, 'Instagram') !== FALSE) ) {
            return 'chrome';
        }
        return FALSE;
     }


.htaccess rewrite rules:

Code:
### LITESPEED_CACHE_START - Do not remove this line
<IfModule LiteSpeed>
CacheLookup on
## Uncomment the following directives if you has a separate mobile view
RewriteEngine On
## Uncomment the following directives if you has a separate Safari browser view
RewriteCond %{HTTP_USER_AGENT} "bot|compatible|images|cfnetwork|favicon|facebook|crawler|spider|addthis" [NC]
RewriteCond %{HTTP_USER_AGENT} !Chrome [NC]
RewriteCond %{HTTP_USER_AGENT} !Mobile [NC]
RewriteRule .* - [E=Cache-Control:vary=isBot]
RewriteCond %{HTTP_USER_AGENT} Bot [NC]
RewriteCond %{HTTP_USER_AGENT} Mobile [NC]
RewriteCond %{HTTP_USER_AGENT} !Chrome [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobilebot]
RewriteCond %{HTTP_USER_AGENT} "Android|iPhone|iPad" [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]
</IfModule>
### LITESPEED_CACHE_END
 
Last edited:

serpent_driver

Well-Known Member
I am always shure! Who is the LiteSpeed expert? Answer: Not you!

Just delete the _lscache_vary cookie and request a URL again with different User-Agent. The _lscache_vary cookie is not set again. Device Detection works at your page, but only if a page isn't cached yet. This means that your cache varies are insufficient and not in sync with your PHP device detection.
 

serpent_driver

Well-Known Member
@AndreyPopov
The problem with your custom solution is that it only works if a page is not cached. Given that running PHP on a cached page is worthless because it is not available, this limitation makes your solution worthless. I don't have to explain to you why this is so. You should/need to know that a cached page makes PHP impossible to run.

Your custom solution will only become valuable and ultimately usable if you either solve the cookie dependencies or use client side scripting, so that in case of doubt the correct cache Vary is always used. But this also requires that you have to revise your custom cache varieties.

Ultimately, what it boils down to is that you not only have to correct your custom solution, but you have to completely redefine it. Otherwise your custom solution is worthless.

I respect your efforts to improve the cache extension for OpenCart, but unfortunately you lack extensive knowledge to make this extension particularly usable for Journal 3.
 

AndreyPopov

Well-Known Member
I already provided the proof! You are required to improve your non-working solution.

https://www.litespeedtech.com/suppo...pport-in-safari-and-lscache.18880/post-127923
where???????

delete cookies and change UA? where proof?



The problem with your custom solution is that it only works if a page is not cached.
bull shit!


I don't have to explain to you why this is so. You should/need to know that a cached page makes PHP impossible to run.
you are NOT UNDERSTAND how lscache work and how use _lscache_vary cookie!



Your custom solution will only become valuable and ultimately usable if you either solve the cookie dependencies or use client side scripting, so that in case of doubt the correct cache Vary is always used. But this also requires that you have to revise your custom cache varieties.
you NEVER read that I write with attention!

lscache now use _lscache_vary cookie for:
- languages and currencies
- sign-in/sign-out users
- phone/tablet users

I add to this _lscache_vary cookie browser and OS for both lscache algorithm and crawler.
 
Last edited:
Top