<iframe> click to load

Reduce some unnecessary resource consumption by suspend the <iframe>s with larger area. NOT lazyload; click a button instead anywhere in the whole <iframe> element so one won't mis-click.

Versión del día 09/12/2020. Echa un vistazo a la versión más reciente.

Autor
Crystal-RainSlide
Calificaciones
0 0 0
Versión
1.3
Creado
05/10/2020
Actualizado
09/12/2020
Tamaño
2.37 KB
Licencia
Desconocida
Funciona en
Todos los sitios

will ignore that:

  • has srcdoc attribute
  • doesn't have src attribute
  • the value of its src attribute is not a valid URL
  • the URL of its src attribute:
    • has a origin that is "null", and/or
    • has a protocol that is not "https:" or "http:"
    • (in other words, is "about:blank", "javascript:*" or "data:*")
  • narrower than 72px, or generally smaller than 128x128px

Just modify the code to change the behavior. If you need a lazyload version, but can't code it yourself, I'm glad to say now you can do this by just set loading=lazy attribute to the <iframe> (and <img>) elements, for the newest modern browsers:

And there are some lazyload libs for reference, for older browsers. Here is one of them:

长期地址
遇到问题?请前往 GitHub 提 Issues。