Home     |      Learn AJAX     |      Forum     |      Register     |      Submit Resource     |      Submit Article      |      Contact Us

Home AJAX-Tips
 

Effective Use of Alternate Style Sheets in Ajax

 

Style sheets are not only important in providing information to the user but are also used as a means of directing users to another part of the website through their link function. Because of its lightweight capabilities, style sheets have been used in almost every website. By properly coding style sheets developers are able to build an application that is heavy with information but less with the required memory.


Alternate Style Sheets are the third form of style sheets. The other style sheets are Persistent Style Sheet, and Preferred Style Sheet. These style sheets are commonly used in different websites as they provide basic functions for streaming information to the user.


The Persistent Style Sheet relays information without any attribute while the Preferred Style Sheet sports the relational attribute. Persistent refers to its ability to be constantly available to the user. The Preferred Style Sheet on the other hand loads when the attribute has been met. This is often used for simpler websites that aims to use smaller bandwidth.


The Alternate Style Sheet on the other hand provides the user the ability which style sheet to choose (Preferred or Persistent). This option is ideal for those who wanted to have a highly flexible website as the bandwidth available in the area of the user differs.


Coding alternate style sheet is remarkably easy. The developer would just have to add “alternate” while adding the title attribute. Title attribute would enable Preferred Style Sheet while the “alternate” word would enable Persistent Style Sheet.


Applying Alternate Style Sheet in Ajax

The alternate style sheet could be very important in Ajax. Not everyone has the right bandwidth to run an Ajax based website. By implementing alternate style sheet, you will be able to build an Ajax based website that is user as well as bandwidth friendly.


The first thing developers have to check on Alternate Style Sheet of Ajax is cookies. Since Ajax could easily load the information to the client side but would eventually crash it because of information overload because of cookies, cookies have to be controlled as much as possible.


The trick in Alternate Style Sheet for Ajax is to loop the information with the style sheet. If it is not duplicated it will be loaded. Next, the information should check if it is preferred or persistent. Expiring cookies is highly recommended to ensure that the application will run smoothly within the browser.


The challenge on alternate style is the OnLoad function. IE and Mozilla have different interpretations of OnLoad so developers might have to build two types of style sheet so that it could be applied to the specific browser. Although it could mean delay in website development, this should be taken into account so that time will be allotted in developing alternate style sheets through different browsers.


Alternate Style Sheet is a great way of saving bandwidth while maintaining usability. Applying style sheet in Ajax is also possible as long as cookies are checked to prevent browser overload. Different interpretations based on browsers should be implemented to ensure usability.



Read Next: Smart Caching with JavaScript



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links