I use two <img>
tags to calculate page load time.
The server returns a 1x1
pixel image and tracks the two timestamps when the request got fired and the difference between them gives me the page load time.
One <img>
tag is just after the beginning of <body>
tag and other just before the ending of </body>
tag.
But the problem is many a times I get the 2nd <img>
tag fired first and then the 1st <img>
tag.
Can anyone tell me how this happens and how do I resolve this? Are the requests sent in parallel?
NOTE: If I am following the wrong approach, please mention an alternative to this but do not mention tools such as google analytics etc.