AJAX Mobile Tutorials
AJAX MobileImproving Ajax Scripts for Mobile Browsers
Ajax in mobile devices is definitely a challenge for developers. Even with the reduced bandwidth requirements, the presence of JavaScript and the continuous streaming of information could easily take its toll on the mobile device. If the developer is unable to move past this challenge, the possibility of effectively browsing an Ajax based application for mobile browsers could be a little bit challenging.
One of the ways of addressing that concern is by optimizing the website’s scripting for mobile browsers. The beauty of optimization for mobile browsing is its effect on regular browsers. Since its small enough to load fast in a mobile browser, it should perform better when loaded in regular browsers.
JavaScript, fortunately, could be compressed. The numerous functions in JavaScript could be combined so that it could create a single file. Mobile browsers could easily read compressed functions so it should be no problem. The only concern for developers when compressing functions of JavaScript is cache and the execution of functions may not be the same altogether.
If you are keeping functions to minimal and data is small enough to execute, this should be no problem. There are a lot of compression tools that you can use online. JSMin and YUI are some of the tools that you can use for compressing scripts. On the other hand, using GZip in compressing your functions is highly recommended since this type of compression is optimized for mobile browsers.
File types should also be considered. Best practice for JavaScript file is to develop external JavaScript instead of executing them as inline JavaScript file. There is a big difference in ease of execution between these file types. External JavaScript file will be streamed to the user once while inline JavaScript files are streamed asynchronously.
Another factor that could greatly affect the loading time of Ajax applications in mobile browsers are external links. External links are small enough to be loaded in mobile browsers but they could drag the loading time of the application when they are linked dynamically. Creating new links during browsing should greatly affect the application. Instead of tagging data as raw information, the browser will take an extra effort in tagging the data as an external URL.
Another smart way of developing an application for mobile browsing is to load the entire data first before loading the functions. Obviously, data is easier to load since raw information could be easily loaded compared to functions. To maximize the performance of the mobile browser, smaller data should be loaded first before the functions are loaded in the browser. By the time the browser has to interact with the functions, the data is already there and connection should have been optimized for the browser.
Ajax may be a little bit challenging for developing an application for mobile browsers. But optimization is possible since JavaScript functions could be compressed and mobile browsers are smart enough to decode those functions. This trick could be coupled with the reduction of external links which will ultimately reduce the loading time for applications in mobile devices.
AjaxWith.com Offers
Sponsored Links
