Title: Lazy Load breaking JavaScript code
Last modified: May 10, 2019

---

# Lazy Load breaking JavaScript code

 *  Resolved [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/lazy-load-breaking-javascript-code/)
 * Hi there,
 * I have a user of my [Advanced Ads Pro](https://wpadvancedads.com/) plugin whose
   ads are not loading because your lazy load feature “optimizes” JavaScript code.
 * I have seen this with WP Rocket and their Lazy Load plugin as well and they were
   able to fix it quickly.
 * This is a rough draft of what is happening.
 * Advanced Ads has a feature that loads ad content using JavaScript. The code would
   look like this:
 * `<script>window.advads_passive_ads = {"<img src=\"https:\/\/example.com\/wp-content\/
   uploads\/2019\/04\/BANNER-600x300.gif\" width=\"300\" height=\"600\" alt=''\/
   >"};</script>`
 * With your lazy load feature enabled, the code is changed to something like this:
 * `<script>window.advads_passive_ads = {"<img data-lazyloaded="1" src="https://
   somelinktoimage.gif" width=\"300\" height=\"600\" data-src='https:\/\/example.
   com\/wp-content\/uploads\/2019\/04\/BANNER-600x300.gif' alt=''\/>"};</script>`
 * Since the apostrophes are not escaped, the whole code breaks.
 * Thanks,
    Thomas

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

 *  [stanley@litespeed](https://wordpress.org/support/users/stanleylitespeed/)
 * (@stanleylitespeed)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/lazy-load-breaking-javascript-code/#post-11525540)
 * Hi [@webzunft](https://wordpress.org/support/users/webzunft/), thanks for reporting
   the issue, temporary you can put the image name to `Litespeed Cache > Settings
   > Media > Lazy Load Image Excludes` for excluding that image from Lazyload. We
   will discuss with our developer by default excluding the images under javascript.
 *  Thread Starter [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/lazy-load-breaking-javascript-code/#post-11595360)
 * Hi there,
 * what came out of the discussion? I was not asking for a single site here, but
   for over 100,000 users of our plugin, so a manual fix is not possible.
 * Thanks,
    Thomas

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

The topic ‘Lazy Load breaking JavaScript code’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/lazy-load-breaking-javascript-code/#post-11595360)
 * Status: resolved