开发者

How can I optimize my web-page (which is quite large)?

i'm working on a web application...

The ap开发者_开发知识库plication is running fine but the problem is the first time wen i open the application in the browser it shows a blank page i have to hit refresh three or four times to load the page completely and correctly.....

I think my application is too heavy to load, However once it is loaded it's good to go....

i have probably 5 JavaScript files which is around 1.3mb in size and also some UI components.....

is there a possible way to control it so that wen i load the application it returns the entire application without the necessarily hitting refresh again and again....

is there a way to optimize this page....

please help...

Thank you in adavance...

hi again,

is there a way to automatically reload the page if it didn't load the first time?


  1. Check whether you can optimize your code in the javascript. Do you need all the functions that are defined in those 5 javascript files?If not you can split it and load it when other pages load that need this functionality.

  2. Try to find out which part of the code is making it too slow?


  • 1.3 MB of javascript is too much. Try compressing your javascript.
    http://jscompress.com/

  • After compression, try delay loading the javascript files which ever possible:

http://www.websiteoptimization.com/speed/tweak/defer/

  • Run YSlow addon to gather more information about optimizations possible

http://developer.yahoo.com/yslow/


The easiest method is to run YSlow on a Firefox Console
You should also compress your javascript files using YUI Compressor


Have you minified your javascript. This makes it more difficult for humans to understand but can significantly reduce the file size. If one of those scripts is jQuery you might consider referencing the copy hosted at google on your page rather than having it hosted on the serve. Google's server is probably faster than your, and a lot of users will have a copy of jQuery from google cached.

If the site is image heavy and PNGs are used you might consider removing some data from them to make them smaller using tools like pngcrush

As mentioned by a few other, running the page through YSlow is very likely to help find issues that could cause slow performance

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜