skip to Main Content

Add display: none to img, the browser will still send image resource requests, how to prevent the browser from loading unnecessary image resources?

Add display: none to img, how to prevent the browser from loading unnecessary image resources?

2

Answers


  1. Try loading="lazy"

    <img src="https://picsum.photos/1920/1080" style="display: none;" loading="lazy" alt="">
    
    Login or Signup to reply.
  2. To prevent the browser from loading unnecessary image resources, you can try the following:

    1. Using Lazy Load: <img src="path/to/image.jpg" loading="lazy" alt="Description of the image">
    2. JavaScript-Based Lazy Loading
    3. Conditional Loading
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search