Title: Uncaught ReferenceError bodyElement is not defined
Last modified: January 14, 2022

---

# Uncaught ReferenceError bodyElement is not defined

 *  [pjlam](https://wordpress.org/support/users/pjlam/)
 * (@pjlam)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/)
 * Hi, recently I got:
 * frontend.min.js?ver=3.7.3:1 Uncaught ReferenceError: bodyElement is not defined
   
   at frontend.min.js?ver=3.7.3:1:13221 at frontend.min.js?ver=3.7.3:1:15449
 * The script is in
    wp-content/themes/astra/assets/js/minified/frontend.min.js?
   ver=3.7.3
 * The error is is referencing ” “Safari” === v[0] && v[1] < 11 && bodyElement.classList.
   add(“ast-safari-browser-less-than-11”));
 * Same issue when running Astra 3.7.6 (I downgraded to 3.7.3) and WP 5.8.3
 * There is no caching plugin like WP Rocket running
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Funcaught-referenceerror-bodyelement-is-not-defined%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [elisabeth01](https://wordpress.org/support/users/elisabeth01/)
 * (@elisabeth01)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15256311)
 * Hi Pjlam,
 * `var bodyElement = document.body;` seems to be missing.
 * Edit:
 * This is for Astra **3.7.6** (free version)!
 *     ```
       var bodyElement = document.body;
       if( 'Safari' === M[0] && M[1] < 11 ) {
          bodyElement.classList.add( "ast-safari-browser-less-than-11" );
       }
       ```
   
 * The code you shared is slightly different in your older version.
    -  This reply was modified 4 years, 4 months ago by [elisabeth01](https://wordpress.org/support/users/elisabeth01/).
    -  This reply was modified 4 years, 4 months ago by [elisabeth01](https://wordpress.org/support/users/elisabeth01/).
 *  [rafaeldplanet](https://wordpress.org/support/users/rafaeldplanet/)
 * (@rafaeldplanet)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15282433)
 * Hi There! I just got the same error, but only on mobile resolution.
 * I’m not sure how to implement Elizabeth’s solution since it is a minified js 
   file.
 * Uncaught ReferenceError: bodyElement is not defined
    at frontend.min.js?ver=3.7.6:
   formatted:357:39 at frontend.min.js?ver=3.7.6:formatted:402:2 (anonymous) @ frontend.
   min.js?ver=3.7.6:formatted:357 (anonymous) @ frontend.min.js?ver=3.7.6:formatted:
   402
 * It is increasing 1.6s the page loading time
 * Please, help!
 * Thanks!!
 *  [clairedelacroix](https://wordpress.org/support/users/clairedelacroix/)
 * (@clairedelacroix)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15295612)
 * Same console error here (astra 3.7.7.1). Yes, only on mobile resolution targeting
   on iOS.
    Error happens even ispecting Astra official website itself.
 * [@rafaeldplanet](https://wordpress.org/support/users/rafaeldplanet/) : you can
   add js with astra custom layouts (only astra pro), via astra hook plugin or in
   a child theme.
 *  [Herman Asrori (BSF)](https://wordpress.org/support/users/bsfherman/)
 * (@bsfherman)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15305708)
 * Hi [@pjlam](https://wordpress.org/support/users/pjlam/),
 * Please try to disable all of the plugins installed on your site temporarily and
   see if the errors disappear. If it does, then please reactivate the plugins back
   one after another until you noticed the errors come back. The last plugin you
   just reactivate could be the culprit.
 * [@rafaeldplanet](https://wordpress.org/support/users/rafaeldplanet/) & [@clairedelacroix](https://wordpress.org/support/users/clairedelacroix/),
   please open your own thread. Although the problem may look the same, the root
   of the causes could be different. Feel free to cross-link your thread with this
   one so we are aware of both. In the meantime, please do what I asked to pjlam
   above.
 * Please let us know how you go.
 * Kind regards,
    Herman 🙂
 *  [clairedelacroix](https://wordpress.org/support/users/clairedelacroix/)
 * (@clairedelacroix)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15308527)
 * Hi Herman,
 * disabled all plugin as debugging routine, js error is still there even with astra
   theme alone.
    I’ve also setted up a local enviroment, same error.
 * It shows up in dev console (incognito mode or not) only emulating iOS devices,
   android and desktop are all fine.
    No performance issue.
 * Could you please check it? Because I’m seeing it on almost every astra powered
   page posted here.
 * Thank you.
 *  [Ahmed Abu Shamia](https://wordpress.org/support/users/colyz93/)
 * (@colyz93)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15331324)
 * Same here
 *     ```
       Uncaught ReferenceError: bodyElement is not defined
           at get_browser (frontend.js?ver=3.7.7:61:30)
           at frontend.js?ver=3.7.7:62:1
           at frontend.js?ver=3.7.7:77:241
       get_browser @ frontend.js?ver=3.7.7:61
       (anonymous) @ frontend.js?ver=3.7.7:62
       (anonymous) @ frontend.js?ver=3.7.7:77
       ```
   
 *  [marcusvarrosa](https://wordpress.org/support/users/marcusvarrosa/)
 * (@marcusvarrosa)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15332692)
 * I have the same problem. I disabled all plugins and the same error follows:
    
   Uncaught ReferenceError: bodyElement is not defined at frontend.min.js?ver=3.7.7:
   1:14048 at frontend.min.js?ver=3.7.7:1:16276
 *  [Herman Asrori (BSF)](https://wordpress.org/support/users/bsfherman/)
 * (@bsfherman)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15338046)
 * So, this error can be seen only on iOS devices? Can you guys please confirm this?
 * Kind regards,
    Herman 🙂
 *  [marcusvarrosa](https://wordpress.org/support/users/marcusvarrosa/)
 * (@marcusvarrosa)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15341268)
 * I have a Macbook with OS X Big Sur, I tested it in Firefox and Safari in responsive
   mode using the inspector and this error only happens in Chrome in mobile mode,
   in desktop mode it works normally.
 *  [Herman Asrori (BSF)](https://wordpress.org/support/users/bsfherman/)
 * (@bsfherman)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15341817)
 * Hi guys, I would like to share an update with you that we were able to replicate
   this issue. We will fix this ASAP. Thank you for reporting this and we are also
   sorry for the inconvenience.
 * Kind regards,
    Herman 🙂
 *  [marcusvarrosa](https://wordpress.org/support/users/marcusvarrosa/)
 * (@marcusvarrosa)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15346951)
 * Ok Herman (@bsfherman),
 * Thanks for the feedback.
    If you can let me know about the update I would appreciate
   it.
 * Greetings.
 *  [Herman Asrori (BSF)](https://wordpress.org/support/users/bsfherman/)
 * (@bsfherman)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15434607)
 * Hi guys,
 * Just wanted to update you guys that the issue has been fixed on [v3.7.8](https://wpastra.com/changelog/astra-theme/#version-3-7-8).
   Please confirm on your end that the issue has been solved.
 * Kind regards,
    Herman 🙂

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

The topic ‘Uncaught ReferenceError bodyElement is not defined’ is closed to new 
replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/astra/4.13.4/screenshot.jpg)
 * Astra
 * [Support Threads](https://wordpress.org/support/theme/astra/)
 * [Active Topics](https://wordpress.org/support/theme/astra/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/astra/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/astra/reviews/)

 * 12 replies
 * 7 participants
 * Last reply from: [Herman Asrori (BSF)](https://wordpress.org/support/users/bsfherman/)
 * Last activity: [4 years, 3 months ago](https://wordpress.org/support/topic/uncaught-referenceerror-bodyelement-is-not-defined/#post-15434607)
 * Status: not resolved