AJAX Made Easy - Learn AJAX

AJAX Categories

 

Latest AJAX Articles

AJAX Home AJAX-Tips

Tweak Your JavaScript for IE

Author: admin | Published: 30th Jan 2008 | Read: 570 times | Add Comment
Filed in: AJAX Tips



Implementing Ajax in IE may not be an issue anymore but there are actually additional tweaks you could do to upgrade the performance of Ajax in IE. It all goes back to JavaScript and there are specific coding designs that a developer could change in JavaScript to upgrade JavaScript’s performance in IE.


The first challenge is to prevent constant symbolic look-up. By default, IE is ok in symbolic look-up however; constant IE look-up will eventually push the IE to the brink of slowing down. IE will take more time in rendering the website when it has to constantly look up the symbol’s meaning while being paired to a function. You can easily optimize this by using “var” in status. This is especially applicable when you’re applying a variable in the specific part of the code.


The next challenge is to cache the indicated variables. Caching is a known problem especially in IE when implementing Ajax. The fact that its asynchronunous make it hard for IE to understand that some parts of the Ajax shouldn’t be cached especially the information fetched from the server. In this case, you have to cache the variable since its part of the program that should be cached to ensure the commands are practically rendered. What usually happens in caching is that you slowly build up the variable so that it could be implemented properly.


However, that will take time since IE will have to interpret each build up individually. Instead of getting the information individually, why not get everything at once? After all, the data that you’ll be retrieving aren’t that big that it will require slow build up process. You can do this by using “var” and string the build up together. That will get the required documents altogether without having to cache each part of the document.


When you have cached the variables for IE, the next step is to cache every pointer. This is not complicated but very tiring since each variable will have different. The only challenge here is again, too much caching could lag your IE because of too many information. Using “var” and combining all the elements, you’ll be able to render all function pointers without having to drag IE.


Last but not the least; avoid using “with” in JavaScript especially when you’re planning to us this program in IE. We all use “with” because it has set a new parameter where the variable and other programs they should work with. However, the downside of with doesn’t cover its bad side. When “with” is constantly used in the program, the scope chain is affected and eventually the program will slow down in IE. Although IE will still read “with’ it will practically slow down its function – much like what a symbol does in IE.


To sum it up, always use “var” especially when you’re dealing with variables. After that, make sure that each pointed in the variable is cached to optimize your communication to the server and lastly, forget about “with” as there are other ways of using parameters without dragging IE program down.






Next: OnLoad for Initial Rendering



Post Comment


You need to Login to post your comment...

Click here to login

Title:
 
Comment:



Daily Email Updates

AJAX Updates delivered directly to your Inbox...

Enter your email address:

Latest AJAXwith Updates
 

Related AJAX Articles

 » IBM Database Connectivity for JavaScript
 » Webkit's SquirrelFish JavaScript Engine
 » Threading in JavaScript
 » ECMAScript 4 - The Future of JavaScript
 » JavaScript Type Attribute
 » Remember These: Flash and JavaScript
 » JavaScript Timers for Ajax
 » Speed up Ajax using JSMin in JavaScript
 » Better DOM for JavaScript
 » Ext JS - JavaScript Library

Popular AJAX Articles