New Native Lazy Loading Attribute for HTML img and iframe tags

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

You might also like

Hack Culture Needs to Die

Anybody else tired of “hack” culture? “7 Hacks to Triple Your…” “A Secret Hack to Instantly Double Your…” “52 Little-Known Hacks to…” I asked my

Read More »
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 secrets to high-paying freelance clients

What makes clients willing to pay $5,000, $10,000 even $20,000 and up for your services? Download and install my mobile app and I’ll show you. It’s free. Just click the button below:

Clients Like:

Inc. Magazine Logo
Lewis Howes Logo
Ray Edwards Logo

WHAT OTHERS ARE SAYING

Daniel Mohlendick

On the Freelancing on Upwork course: “This is by far the best course i have watched on Skillshare!! Thank you so much.”

Thabo Motsoahae

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

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.

Oliver Wainwright

Oliver Wainwright

I’m a fan. I have completed several of John’s courses. I find him very knowledgeable and he has a great delivery.

Aaron Gott

Aaron Gott

John has a particular knack for the development and training of others.

Bradley Smith

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

Michael Skye

Michael Skye

John is a man of integrity, who gives generously of himself to projects and people he cares about.

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.

Xan Barksdale

Xan Barksdale

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

Jim DeJonge

Jim DeJonge

John has a relaxed and engaging manner. His advice is solid and the explanations are well thought out.

Andrew Malone

Andrew Malone

John Morris is exceptional in his ability to give focused insight into Freelancing and starting one’s business. His direct methods inspire confidence in his honesty.

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!

Steve Dimmick

Steve Dimmick

John has provided expert knowledge and advice on multiple occasions that have helped me better serve my clients. John is a Rockstar!