• Resolved thelyall

    (@thelyall)


    I love this plugin but after just leaving a review I noticed an issue – if I have the Enable Async JavaScript option ticked it breaks the mobile menu and flyout cart scripts (mobile menu doesn’t show at all and cart button does nothing). Desktop seems ok… I can’t see any console errors on desktop when emulating a small screen, and I’ve tried various combinations of options but the only way I can get it to work is by disabling the option ??

    I think I might need to exclude a script, but as I can’t use F12 developer tools on my phone I can’t see what to exclude. Do you have any ideas? It seems to be the product pages which are worst affected, it also seems to stop the product images loading (or presumably the script that loads them).

    Thanks
    Lyall

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter thelyall

    (@thelyall)

    Sorry I just realised this relates to the Async JavaScript plugin, should I move it?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Had a quick look at your HTML source and I see no advantage in running AsyncJS really, so I would just leave that off? ??

    Thread Starter thelyall

    (@thelyall)

    If I enable it my page speed score goes up quite a lot on mobile (55 without it) so it would be nice to include it… But not the end of the world. I’d like to figure it out though! On desktop it takes it up from 95 to 99 so not as much of a change as on mobile.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    hmm, if you compare the HTML source with and without async JS, which scripts are asynced (or deferred) which are not without it?

    Thread Starter thelyall

    (@thelyall)

    Sorry, how can I tell if a script is deferred? ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you can see in the page HTML source;

    <script defer="defer" scr="<url here>">
    or
    <script defer scr="<url here>">
    or if asynced
    <script async="async" scr="<url here>">
    or
    <script async scr="<url here>">

    Thread Starter thelyall

    (@thelyall)

    Thanks. As far as I can see the only deferred script is:

    <script type="text/javascript" defer='defer' src="https://k-beauty.global/wp-content/cache/autoptimize/js/autoptimize_1e2b7233dd0e34df1e546fcf8e23b78c.js"></script>

    And the only async on the product page are:

    <script data-cfasync="false" id="ao_optimized_gfonts_webfontloader" type="text/javascript">(function() {var wf = document.createElement('script');wf.src='https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';wf.type='text/javascript';wf.async='true';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(wf, s);})();</script>

    <script async data-noptimize="1" src='https://k-beauty.global/wp-content/plugins/autoptimize/classes/external/js/lazysizes.min.js'></script>

    These are the same whether async is enabled or not (weird) but I just checked again and if I enable the option the product pages break, and as soon as I disable it (and clear cache) they work again…

    I think it might a script that only runs on mobile view? I will try to experiment later.

    Thanks

    Thread Starter thelyall

    (@thelyall)

    Hello,

    Ok I found out the reason the page didn’t change when I had it enabled/disabled was because I hadn’t ticked the box for it to apply to logged in users and I was logged in! ??

    However, I wasn’t able to find the problem and even disabling the plugins one by one to try and narrow it down didn’t find the problem either. So unfortunately I’ve had to disable the tickbox (and effectively the plugin). On the plus side though, I was able to get my page score back up to 86 (mobile) and 97 (desktop) just by going through and identifying plugins which didn’t REALLY need to be enabled.

    I’ll have another look at this in the future though as I want to get it working…

    Thanks

    Hey guys,

    Just a quick note to tell you how I fixed this problem for myself. At the bottom of Async JavaScript Settings, be sure to change Autoptimize support for jQuery Method to Defer, as it defaults as Async.

    As shown here.

    After doing this, my mobile menu is now fully functional with Enable Async JavaScript? ticked.

    Hope this helps,

    Cheers

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    great job l33roi, thanks for sharing! ??

    Thread Starter thelyall

    (@thelyall)

    That didn’t fix it for me – I tried it already but just tried again to make sure and it still has the same problem regardless of what options I select. Glad it worked for you though ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Async Javascript mobile menu/script issue?’ is closed to new replies.