• Resolved maciej.z

    (@maciejz)


    I have noticed strange behaviour on my website. Sometimes the content just would not load (for example on homepage). It does not happen all the time – but I am able to replicate it on incognito mode (it happens every 2-3 new sessions)

    Developer tools show the following error:

    Uncaught TypeError: Cannot read properties of undefined (reading ‘browser’)
    at HTMLDocument.<anonymous> (autoptimize_c223b233856963a7069f2c30f3602c39.js:44)
    at s.fn.init.n.fn.ready.n.fn.init.ready ((index):5)
    at autoptimize_c223b233856963a7069f2c30f3602c39.js:44

    And here is this line 44:

    jQuery(document).ready(function(){‘use strict’;rockthemes_extend_modernizr();var spfx=”;switch(BrowserDetect.browser){case’Chrome’:spfx=’-webkit-‘;break;case’Explorer’:spfx=’-ms-‘;break;case’Firefox’:spfx=’-moz-‘;break;case’Safari’:spfx=’-webkit-‘;break;case’Opera’:spfx=’-o-‘;break;}

    After reloading this error disappears and everything works fine. But when I start a new incognito mode session (every 2-3 sessions) it happens again.

    What should I do to fix this error?

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

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

    (@optimizingmatters)

    Can you try excluding wp-content/plugins/azoom-main/js/azoom.jquery.js or wp-content/plugins/azoom-main/ from JS optimization?

    Thread Starter maciej.z

    (@maciejz)

    I added this script – https://prnt.sc/2097q8v

    But now I get another error – and the page won’t work at all. Here is the error:

    Uncaught ReferenceError: jQuery is not defined
    at autoptimize_single_a4543aaac48597ee09d0e8c94317f1f9.js:1

    and this line is:

    jQuery(document).ready(function(){‘use strict’;rockthemes_extend_modernizr();var spfx=”;switch(BrowserDetect.browser){case’Chrome’:spfx=’-webkit-‘;break;case’Explorer’:spfx=’-ms-‘;break;case’Firefox’:spfx=’-moz-‘;break;case’Safari’:spfx=’-webkit-‘;break;case’Opera’:spfx=’-o-‘;break;}

    • This reply was modified 3 years ago by maciej.z.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ah, in that case you’ll have to re-exclude (it’s excluded in the default configuration) jquery.min.js as well ??

    Thread Starter maciej.z

    (@maciejz)

    I did it – this is what the list look like: https://prnt.sc/209f1di

    And now I get these errors – https://prnt.sc/209ez4n.
    Do you need any details on this or can you help without them?

    • This reply was modified 3 years ago by maciej.z.
    Thread Starter maciej.z

    (@maciejz)

    I had to revert to the previous exclusion list (https://prnt.sc/209orzh), so that the website is operational again.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    hmmm, the you’re using rocketlazyload to lazyload (some of) your JS might complicate things here. try above exclusions (and maybe add jquery-migrate.min.js to it) with rocketlazyload off maybe? or switch to “don’t aggregate but defer” (with and without rocketlazyload)?

    Thread Starter maciej.z

    (@maciejz)

    What do you mean by rocketlazyload? I am not using lazy loading for WP Rocket if this is what you meant. Also – I am not using lazy loading in Autoptimize – Lazy load feature is a part of Shortpixel Adaptive Images plugin – here are the options for lazy loading: https://prnt.sc/20cgyj6

    Could you be more specific on the options I should test? That would help me a lot.

    thanks in advance,
    Maciej

    • This reply was modified 3 years ago by maciej.z.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Well, WP Rocket has a function to delay JS and when that is on you’ll see references to RocketLazyLoadScript in your HTML source which I currently see, so try disabling that option in WP Rocket and then re-try the exclusions you had previously?

    Thread Starter maciej.z

    (@maciejz)

    I managed to find a combination that creates no error.
    Thanks!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    feel free to share for future users ??

    Thread Starter maciej.z

    (@maciejz)

    WP Rocket – I switched off delaying javascript.
    Autoptimize – I switched on “Do not aggregate but defer?” and added the following scripts to the exlcuded list: addtoany.min.js, jquery.min.js, azoom.jquery.js, jquery-migrate.min.js

    • This reply was modified 3 years ago by maciej.z.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    thanks for sharing maciej, enjoy your weekend! ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘problems with autoptimize’ is closed to new replies.