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 more freelance clients?

I’ll show you what I learned over the last 15 years to grind out (from absolute scratch) a backlog of new clients wanting to hire you. Who your best client prospect are, what services you should be offering them, where to find them and more. Just enter your email address in the box below and let’s get started:

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.

You might also like

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Do you want more freelance clients?

Enter your email below to get started building your system for consistently bringing in new freelance clients:

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!

Ray Edwards

I recommend John every chance I get. If every person I worked with were as committed to excellence, punctuality, value, and unquestionable integrity… the world would be a better place. Highest recommendation.

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.

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.

Close Menu