Mobile web environments are loaded with issues which tend to serve as a huge headache for Iphone and android developers who are trying to come up with robust and eye-catchy websites and web applications. Thankfully, we have an easy availability of some of the finest web technologies like HTML5, CSS3 etc. which have allowed us to combat major web development issues such as choppy page transitions, spinning refreshes and periodic delays in tap events.

Today, in this post, you’ll get to know about some of the best HTML5 techniques that allow you to unmask the hidden complexities associated with optimized mobile performance of websites and applications. So, let’s get on with our journey of exploring a lot more about these HTML5 techniques.

1.Don’t neglect the core CSS3 features
With more and more developers choosing a third-party framework for dishing the animation process of divs, text with drop shadows, backgrounds, images etc. it is quite essential to pay special attention to the core CSS3 features. Whether it is memory allocation or reducing the overall computational burden, paying heed to your CSS3 utilities will enable you to combat a variety of device constraints that tend to crop in while creating mobile-friendly web apps. Also, don’t forget to check whether or not you have any overalapping hardware acceleration for any specific part of your web/app page.

2.Debug the hardware acceleration
Now, to make the debugging of hardware acceleration work, it’s time to fire up around two browsers along with one of your favorite IDEs. Here, start Safari from your command line and use debugging environment variables. Just open the Terminal and type in the following there:
$> export CA_COLOR_OPAQUE=1
$> /Applications/

Here’s an explanation of the above commands:
It shows all the elements that have been actually accelerated or composited.
It shows the amount of memory that you are using while sending the drawing operations i.e. the total strain that you’re putting on the mobile device.

3. Detection, handling and profiling of network type
Since you have an ability of buffering your web app, it becomes quite essential for you to render appropriate connection detection features that can make your app more intuitive. It is here that mobile app development gets a bit sensitive in terms of online/offline modes and the connection speed.
Have a look at the below code which provides offline access via applicationCache, detects when mobile apps gets switched from offline to online mode and vice-versa, detects if the app has been bookmarked and is offline, detects all slow connections in addition to fetching content that’s based on the network type. Here’s the code that I’m referring to:
window.addEventListener('load', function(e) {
if (navigator.onLine) {
// new page load
} else {
// the app is probably already cached and (maybe) bookmarked...
}, false);
window.addEventListener("offline", function(e) {
// we just lost our connection and entered offline mode, disable eternal link
}, false);
window.addEventListener("online", function(e) {
// just came back online, enable links
}, false);

If you look at the above code, you’ll find that body onload event won’t get fired each time the app switches from offline to online mode and vice-versa.
Next, there is yet another piece of code snippet which allows you to check for an onload or ononline event. Here’s the code that I’m referring to:
function processOnline(eventType) {
// reset our once disabled offline links
if (eventType) {
for (var i = 0; i < disabledLinks.length; i++) { disabledLinks[i].onclick = null; } } }

With the above code, all the lines related to switching the app from offline to online mode would be disabled. As a web development professional, you can choose to insert a logic into the app as per which you can resume the process of fetching content or handling the application's UX in case of intermittent connections.

4. Pre-fetching and caching app pages using concurrent AJAX calls
In order to take a new leap in relation to page and resource caching, you need to pre-fetch and cache all the app pages using the concurrent AJAX calls. Let's take a closer look at the core mobile web problems and reasons which make pre-fetching and caching utmost essential:
1.Pre-fetching allows your users to take your app offline in addition to enabling no time delays between multiple navigation actions. Doing this will play a vital role in preventing device bandwidth choking each time the device goes online.
2.Caching- You need to opt for a concurrent or asynchronous approach when it comes to fetching or caching the pages. There are times when you'd also need to use localStorage which isn't asynchronous.
3.AJAX and parsing the response- Well, here instead of using innerHTML() for inserting AJAX response into DOM, you can opt for using a much more reliable mechanism for inserting the AJAX response and handling concurrent calls. Additionally, you can make the most of HTML5 features for parsing xhr.responseText.
That's it for now!

Wrapping Up
Mobile HTML5 apps can serve as a great asset for your client if you've customized it to an optimum level. Hoping the above post would have helped you in gathering useful insights on working with and addressing HTML5 features for apps that look stunning and operate flawlessly on all kinds of mobile devices.

About the Author:
This is a guest blog post written by Amanda Cline, Along with working as a Programmer at Xicom Technologies- A leading Android Application Development Company, I am a compulsive reader, writer and a wannabe photographer. Technology intrigues me and this is why I like to read and write about Mobile Application Development and Custom Software Development.



Latest posts by webgunjan (see all)