Lazy Load breaking JavaScript code
-
Hi there,
I have a user of my Advanced Ads Pro 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
The topic ‘Lazy Load breaking JavaScript code’ is closed to new replies.