O'Reilly logo

Mobile Web Performance Optimization by S. Niranga

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Empty source and link attributes

If we have an HTML tag containing an attribute, without value, we say it is an empty attribute. The issue with this empty attribute is, if the empty attribute is a source or a link, some browsers will still try to connect to the server, even we set it as an empty value. This unwanted request and overhead will create delays in our mobile website or application. As an example, take a look at the following anchor tag and image tag:

<a href="">
<img src="">

Also, take a look at the following JavaScript code:

var image = new Image();
image.src = ""

Usually, the HTML recommendation is that if there is an src attribute, it should contain a URL. However, if you are using HTML5, you can have an empty attribute because, HTML5 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required