Poor Coding Of Mobile Websites Is Draining Your Device
Websites need to be architected much like complex buildings are. Intelligently, and with fore-thought.
Can’t figure out where all the battery power went within a few hours of charging your smartphone?
Been refraining from watching videos or playing games, and yet smoked out?
Well, research suggests that poorly designed mobile websites are to blame. Researchers at Stanford have determined that not only do free apps use a lot of battery, even just browsing the ‘net comes with its share of battery drain.
Results showed that even for mobile-optimized versions of popular websites, downloading and parsing CSS, Javascript and images consumes a significant percentage of the total energy needed to render the webpage. Furthermore, JPEG images were found to be more energy efficient as compared to GIF and PNG images.
This occurs due to a poor understanding of the browser’s energy use — the amount of energy used to render images is proportional to the number and size of images on the page.
For instance, the YouTube page has 5 large images on its homepage; nearly 24.2% of the total energy to render the page is spent on images.
Obviously, getting rid of all the images on every website is not an option! So, what does one do then?
Fret not, for the team from Stanford proved that tweaking the Javascript for a page to contain only functions contained by the page itself greatly reduces energy use. Consequently, Gmail was determined to be the most ‘green’ site as it uses HTML links to open emails that the user clicks on.
Similarly, findings show that like Javascript, CSS files should be page-specific and contain only the rules required by the elements in the page.
Modification of the CSS code on Apple’s website according to these guidelines caused the energy consumption to fall from 12 joules to 7 joules! It’s astounding that simplification, optimisation and a simple self-containment of code can make such a difference!
With a significant proportion of web browsing being done on smartphones these days, this is an important set of findings. The suggestions from study imply that it essential that businesses have energy-optimised, mobile versions of their website.
So now you know that your device is not always to blame for the short battery life, it could be the sites that you choose to visit, so choose your web-sources wisely.
Originally published at Chip-Monks.