New Native Lazy Loading Attribute for HTML img and iframe tags

DISCLAIMER: This post may contain “affiliate” links to products and services I recommend. I’ll receive a small commission if you decide to purchase one of these products or services. I only recommend products I genuinely believe will help you in running your freelance business.

Lazy loading your images just got a whole lot easier. If you’re not familiar, lazy-loading is the practice of delaying the load of certain content on a page until a user scrolls near it.

If a user never scrolls, the content never loads.

Page speed performance, mobile… good for all that.

Currently, you’ll need JavaScript to do this.

But, as of Chrome 75, that’s no longer necessary. A new attribute for <img> and <iframe> tags, loading” will be supported. Supported parameters are:

  • lazy: good candidate for lazy loading.
  • eager: not a good candidate for lazy loading. Load right away.
  • auto: browser will determine whether or not to lazily load.

Implementation is as such:

<img source="dope" loading="lazy">
<img source="dope" loading="eager">
<img source="dope" loading="auto">

<iframe src="dope.html" loading="lazy"></iframe>

If the loading attribute is not added, it defaults to “auto”. The best part is, even without full browser support, you can start implementing this now. It won’t affect anything if the browser doesn’t support it.

But, for the ones that do (once more and more browsers jump on board), the benefit will automatically kick in.

Anyway, one of the many little things in HTML that can make your life a lost easier… if you know them. There’s been more and more of this kind of stuff coming out lately.

One of the ways you can keep up with all of it is my Beginner’s Guide to HTML course on SkillShare. Discover all the little things you might have missed while learning how to write standards-compliant HTML.

And, we build real things.

Like a HTML5 audio and video player complete with a playlist and autoplay. In any case, if you want to keep going with your HTML training, you can access it for FREE over on SkillShare.

All the details on that are here: http://johnmorrisonline.com/skillshare

Later,

John

Do you want high-paying freelance clients?

I’ll show you what I learned over the last 15 years about building a 100K freelance business from complete scratch. What I did to land projects with Inc. Magazine, Tim Ferris, Lewis Howes, Michael Hyatt and others. Just enter your email address in the box below and let’s get started:

Leave a Reply on Twitter

Due to excessive spam, I’ve disabled comments on my website. If you have a question or would like to leave a comment, don’t hesitate to contact me on Twitter.

You might also like

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on reddit
Reddit
Share on pinterest
Pinterest
John Morris

JOHN MORRIS

I’m a 15-year veteran of freelance web development. I’ve worked with bestselling authors and average Joe’s next door. These days, I focus on helping other freelancers build their freelance business and their lifestyles.

The simple secret to high-paying freelance clients?

Enter your email below and I’ll show how to charge more and build a 100K freelance business from scratch:

Clients Like:

Inc. Magazine Logo
Lewis Howes Logo
Ray Edwards Logo

WHAT OTHERS ARE SAYING

Sukh Plaha

John is a fantastic and patient tutor, who is not just able to share knowledge and communicate it very effectively – but able to support one in applying it. However, I believe that John has a very rare ability to go further than just imparting knowledge and showing one how to apply it. He is able to innately provoke one’s curiosity when explaining and demonstrating concepts, to the extent that one can explore and unravel their own learning journey. Thanks very much John!

Bradley Smith

John and I have worked together on numerous projects. John is very quick and efficient and was a pleasure to work with.

Chris Aitken

He significantly improved my site through his expert knowledge of PHP, CSS and Javascript. Would definitely recommend John to others.

Lewis Howes

John is amazing at building membership sites. He converted one of my sites over from it’s existing (hardly working) platform over to the clean and simple to use WishList membership platform. I highly recommend using John and WishList for any of your membership site needs.

Bob Patterson

Not only is John a very talented programmer and developer, he is also an excellent communicator. He has a talent for taking complex subjects and communicating them in terms that anyone can understand. This is a rare combination. This ability has enabled me to take my skills and knowledge to the next level. Thank you John for for all that you do.

Thabo Motsoahae

John is one of the best instructors I have come across, I learned a lot from his online tutorials.

Xan Barksdale

Xan Barksdale

Very professional worker who is extremely knowledgable in WordPress and Wishlist Member. I would definitely hire again.