Support » Plugin: Autoptimize » Lazyload on Mobile Only

  • Great plugin! – Is there a way to only switch on LazyLoading for mobile? I didn’t know if we can add something into the functions, something like this (I know this is wrong… but..something along these lines)

    if ( wp_is_mobile() ) {
    add_filter(
    ‘wp_lazy_loading_enabled’,
    ‘__return_true’
    );
    }

    Or is there perhaps another way you can suggest?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    possible, but that would require you to configure page cache (which I assume you have) to cache different versions for mobile & non-mobile?

    Thread Starter squire2k

    (@squire2k)

    Thanks,sorry, when you say configure ‘page cache’ – is that referring to any options within your plugin, only I couldn’t see anything in there for mobile/non mobile etc – or am I missing a piece of the bigger picture here 🙂

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    bigger picture indeed; AO does not do page caching, but I assume/ hope you (or your host) does have page caching, as it’s an important tool for web performance optimization (esp. to keep the “server response time”/ “time to first byte” as low as possible.

    now if you have page caching and if you would implement code *not* to lazyload on desktop (but only on mobile) then you can end up with cached pages (HTML) that have lazyload on or off, depending on what device requested the page the first before being stored in page cache. so if you would have page caching (and you should) then adding such code should only be done if your page caching allows a page to be cached seperately for mobile and desktop?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.