Some embed providers use <iframe> for loading of their content, but other use plain HTML or iframe followed by <script src>. Most notable example is Twitter, but there are others like Tumblr, Vine, Instagram...
This means that their JavaScript file is loaded and <iframe> created while loading page and lazy loading is not working for them. In my commit dimadin/bj-lazy-load@5bf81af8ca418890a3b130f4de8c86df40f45ae3, I showed how this can be done for Twitter, but this is not practical because all sources must be manually defined and they can change.
What can be done is to do some regex to find script source, then replace that <script> tag with placeholder image, while JavaScript can stay the same or similar as in my commit. The only question is what to do if script has more attributes.
Other option is to put some trigger in your JavaScript file so that I don't need to edit that file after updates.
Some embed providers use
<iframe>
for loading of their content, but other use plain HTML or iframe followed by<script src>
. Most notable example is Twitter, but there are others like Tumblr, Vine, Instagram...Here is a Twitter example:
This means that their JavaScript file is loaded and
<iframe>
created while loading page and lazy loading is not working for them. In my commit dimadin/bj-lazy-load@5bf81af8ca418890a3b130f4de8c86df40f45ae3, I showed how this can be done for Twitter, but this is not practical because all sources must be manually defined and they can change.What can be done is to do some regex to find script source, then replace that
<script>
tag with placeholder image, while JavaScript can stay the same or similar as in my commit. The only question is what to do if script has more attributes.Other option is to put some trigger in your JavaScript file so that I don't need to edit that file after updates.