Title: JavaScript ERROR site wide
Last modified: January 8, 2020

---

# JavaScript ERROR site wide

 *  [pirulee](https://wordpress.org/support/users/pirulee/)
 * (@pirulee)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/javascript-error-site-wide/)
 * JavaScript error is thrown on any page or post type that does not include comments.
 *     ```
       embed.js:39 Uncaught TypeError: Cannot read property 'appendChild' of null
           at k (embed.js:39)
           at Object.l [as isSerif] (embed.js:39)
           at h.i.toJSON (embed.js:39)
           at Object.c.loadEmbed [as _loadEmbed] (embed.js:41)
           at embed.js:41
       ```
   
 * The issue is that you are loading your javascript assets every time and anywhere.
   You should only enqueue your files when the actual IFRAME rendering is called.
 * In other words, only use `wp_register_script()` on hook `wp_enqueue_scripts` 
   and user `wp_enqueue_script` right before you are actually going to echo or render
   the iframe.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjavascript-error-site-wide%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

The topic ‘JavaScript ERROR site wide’ is closed to new replies.

 * ![](https://ps.w.org/disqus-comment-system/assets/icon.svg?rev=1636350)
 * [Disqus Comment System](https://wordpress.org/plugins/disqus-comment-system/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/disqus-comment-system/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/disqus-comment-system/)
 * [Active Topics](https://wordpress.org/support/plugin/disqus-comment-system/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/disqus-comment-system/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/disqus-comment-system/reviews/)

## Tags

 * [enqueue](https://wordpress.org/support/topic-tag/enqueue/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 0 replies
 * 1 participant
 * Last reply from: [pirulee](https://wordpress.org/support/users/pirulee/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/javascript-error-site-wide/)
 * Status: not resolved