Problem/Motivation

In #3060605: Support lazy loading of images we will add lazy loading option for images and iframes. Recent core changes made iframe support more difficult. We need to improve iframe support and also decide which iframes we want to cover:

  • Core is using now media embed for loading of youtube. Not 100% sure but probably twitter, instagram, etc reusing similar technique? Oembed is using html_tag to render iframe. We need to inject loading attribute either over field preprocessor or use element info alter to add a pre-render callback to html_tag.
  • Figure minimally which iframe types we should support out of the box: video (youtube, vimeo...) twitter, instagram...
  • Should iframe types be configurable - so admin can pick which iframes are lazy-loaded and which ones are not?
  • Last, but not the least, note that this will not work in older Firefox, Firefox for mobiles, IE11, Safari: https://caniuse.com/#feat=loading-lazy-attr. Should we use polyfills for those or just state that we don't support this functionality in those browsers? Safari should be fixed soon: https://bugs.webkit.org/show_bug.cgi?id=196698.
CommentFileSizeAuthor
#3 3157699-3-lazy-loading-iframe.patch3.46 KBpivica

Comments

pivica created an issue. See original summary.

pivica’s picture

Issue summary: View changes
pivica’s picture

StatusFileSize
new3.46 KB

@berdir suggested in #3060605-13: Support lazy loading of images to remove iframe support for now which make sense, if we are going to do it, we should do it in this issue and not just half do it in previous issue.

Here is a patch of all old lazy load iframe code here so changes are saved.

pivica’s picture

Version: 8.x-1.x-dev » 2.x-dev

This can be complex because you don't want to block ads trackers and other stuff, moving to 2.x version.