these days , owrking on my project…my webpages are getting very fat withthe inclusion of custom java script code for ajax and validation. To achieve user-experience, im loosing on web page load time. Its taking a while for the page to load. This certainly is making a sectoe the users frustrated and possibly quit d site. So i was wandering a way to come out of this. This is waht ive realized:
1) Place only the very important css and js in the HEAD part. i.e only that css and js thats required 4 d rendering/layout of the page shall be included in the HEAD part. The rest shall go just before the </BODY> tag. This ensures that, the extra script and css which may be useful while validation/ajax stuff be loaded after the contents of the page gets loaded. This ensures that the page gets visible first…making the user not wait 4 a long time…and then get the other css and js.
2) Minify the js. This step involves requires that, u eliminate the extra spaces, comments, tabs in ur js code….thus reducing its size….so that it will take less time 4 d browser to load. The tool i use for this is JSMIN.
3) Also ensure that the number of css and script files are less. The number the number of script/css, the more the number of http requests it takes to access them. So it takes more time to load. So the best way is that..u put all the related js code in possibly one js file and similarly all the rtelated css in one css file. U can go for more if u feel that….its necessary to maintain d hierarchy. Thus, it takes less number of requests to load them.
These are the very basic steps to reduce the page load time. There are still 8+ techniques. The one i refer is yahoo’s suggestions. There a plenty more…Just say “web page performace” in any search-engine…..yuo’ll be flodded wid lnik dying 2 help u.
Hope this pages helps u. Happy webpages.