Simple guidelines to optimize online resources
Now every other site offers its own set of tips to increase the performance of sites, they have a search engine Yahoo.
Firstly, when using HTTP do not forget:
- Avoid HTTP requests - less than them, so much the better;
- Use the headings «Cache-control» or «Expires»;
- Forget about redirect (HTTP Redirect).
Second, Java scripts require care:
- Check the script files to duplicate code that makes reloaded rates and delay the update of the page;
- Get rid of Java requests to the DOM, at least partially, by doing caching, casts repeated requests;
- All blocks Java with images leave the load in the least;
- When handling events in a pinch, use onresize, audits were carried out using YUI Event, and the usual "onload" to replace utility DOMContentLoaded.
Third, when dealing with Ajax requests:
- Cache them;
- Use GET, accommodating all requests in a single packet TCP.
Fourthly, CSS is also possible to optimize:
- Do not litter CSS computable expressions (expression);
- Be sure to reset the buffer still at the start page was generated by periodic call flush () in PHP, then the user will download CSS files;
- To load the CSS, use at the beginning of the page is notimport, and "link";
- Forget about the filters, they are supported only IE / better take into circulation PNG8.
Fifth, be patient and careful when writing the site:
- All pages before giving compress, for example, through the utility mod_gzip;
- To use the services of content delivery networks such as Akamai;
- In page does not prescribe more than three links to other domains, whether referring to a picture or iframe, because the site has to wait for an answer other people's servers;
- When using IFRAME, try to keep only the basic, as well as get rid of references to other people's resources, or the page may remain locked;
- In Apache configure ETags;
- Rationally selects those scripts that are needed in the initial charge;
- And all the content divide in equal shares by the existing domains, then the browser to load all the data at the same time;
- Minimize the number of elements in the tree DOM, remove unnecessary tags;
- Trite, but make sure that you do not appear error 404;
- Cut the size of Cookie: abbreviate names, define the length of life, remove all unnecessary;
- In support pages instead use Cookie imposition of scripts static.domain.com;
- If you choose to add Flash, pre-define the crossdomain.xml.
Sixth, pay attention to the image:
- Work on the used image (used to reduce the size palette, fill the image * PNG format using a utility optipng, pngoptimizer or pngcrush, delete comments, and in the case of * jpg optimize files via jpegtran);
- To create the background images using CSS sprites;
- Check the coincidence of the real size of the image with prescribed parameters width and height (there will be no problems with scaling).
- Remember that the favicon.ico should not exceed 1 KB and to be cached, because search engines use it in every tenth request.
And finally, in the seventh, when creating a site that is optimized for mobile devices:
- Do not create multiple pages, more than 25 KB;
- Use multipart blocks that allows automatic packaging of all additions to the application.