Title: problems with autoptimize
Last modified: November 20, 2021

---

# problems with autoptimize

 *  Resolved [maciej.z](https://wordpress.org/support/users/maciejz/)
 * (@maciejz)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/)
 * 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fproblems-with-autoptimize%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15088522)
 * 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](https://wordpress.org/support/users/maciejz/)
 * (@maciejz)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15088572)
 * I added this script – [https://prnt.sc/2097q8v](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 4 years, 6 months ago by [maciej.z](https://wordpress.org/support/users/maciejz/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15088610)
 * 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](https://wordpress.org/support/users/maciejz/)
 * (@maciejz)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15088622)
 * I did it – this is what the list look like: [https://prnt.sc/209f1di](https://prnt.sc/209f1di)
 * And now I get these errors – [https://prnt.sc/209ez4n](https://prnt.sc/209ez4n).
   
   Do you need any details on this or can you help without them?
    -  This reply was modified 4 years, 6 months ago by [maciej.z](https://wordpress.org/support/users/maciejz/).
 *  Thread Starter [maciej.z](https://wordpress.org/support/users/maciejz/)
 * (@maciejz)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15088704)
 * I had to revert to the previous exclusion list ([https://prnt.sc/209orzh](https://prnt.sc/209orzh)),
   so that the website is operational again.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15089070)
 * 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](https://wordpress.org/support/users/maciejz/)
 * (@maciejz)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15089274)
 * 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](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 4 years, 6 months ago by [maciej.z](https://wordpress.org/support/users/maciejz/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15089334)
 * 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](https://wordpress.org/support/users/maciejz/)
 * (@maciejz)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15109684)
 * I managed to find a combination that creates no error.
    Thanks!
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15109685)
 * feel free to share for future users 🙂
 *  Thread Starter [maciej.z](https://wordpress.org/support/users/maciejz/)
 * (@maciejz)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15109688)
 * 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 4 years, 6 months ago by [maciej.z](https://wordpress.org/support/users/maciejz/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15109691)
 * 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.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 12 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/problems-with-autoptimize/#post-15109691)
 * Status: resolved