'Should I put href attribute before rel on link tag?
As in here https://github.com/joshbuchea/HEAD#performance, it recommends putting the href attribute before the rel attribute. I used to put rel before href.
However, I want to ask what is the best behavior?
If there is more info about this, please brovide me :)
Solution 1:[1]
To keep the answer simple think of GZIP compression as looking for commonly occurring substrings in a file and replacing them with numbers. For example for the following string
aaabbdjdhdaaabbldkffaaabb
the GZIP algorithm would replace it with
1djdhd1ldkff1
ie it makes the substitution aaabb -> 1 in order to reduce file size. The actual algorithm is more complex but this will do for our purposes.
In order to make a page load faster you want to construct your page so that you have these long repeating strings. This way GZIP will be better able to reduce file size. Since your href is used commonly in <a>
it means most html pages will contain a of of strings on the form <a href="https://www.
which GZIP can replace easily with a substitution. By being consistent with the order you put the tags the more GZIP can reduce file size without making new substitution rules.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mr Lister |