Hitro nalaganje spletne strani je ključnega pomena. Po nekaterih raziskavah uporabniki čakajo 2 sekundi, potem je pa že velika verjetnost, da bodo zapustili vašo spletno stran ali spletno trgovino, če se še ne naloži.
Kaj lahko naredite za pohitritev?
1. Make Fewer HTTP Requests
Steve Souders, a world-leading expert on site performance, starts his book High Performance Web Sites: Essential Knowledge for Frontend Engineers with an HTTP overview, perhaps because HTTP requests can be a leading cause of slow page load times.
You can think of an HTTP request as a conversation between the browser and the web server. The browser requests a file or URL and the web server responds with the requested data. Generally speaking, it is better for performance to make fewer requests even if those requests are for larger files.
Specifically, try these 3 techniques to cut down on HTTP requests.
First, load JavaScript files with LABjs. LABjs is a free tool that loads JavaScript files in parallel, meaning that your pages could load much more quickly, especially if you have a lot of JavaScript files on your site.
Next, when possible concatenate style sheets or other files. Simply put, consider having one or two larger cascading style sheets instead of several smaller files.
Third, use image sprites. A sprite is a compound image that contains all of the various states of variable site graphics. For example, take a look at the menu in Apple’s online store. When you hover over one of the links you are encountering a sprite. Rather than loading lots of images, Apple is loading one image and reusing it.
2. Optimize Images
Image files can be a major contributor to slow loading pages, so after your designers have created your page graphics, do your best to optimize the file size and format of each image. For example, if you’re designer used GIF files (which should probably be avoided) try converting them to PNG files. Often this can result in a file size savings, especially when you’re using transparency. PNGs are much higher quality than GIF too.
Also, consider using Pngcruch, an image file optimizer that can squeeze every wasted bit out of a PNG file. In many cases, a “crushed” PNG will be the smallest image file you can find.
For product photographs or similar you may find that JPG files offer the best balance of image quality and file size.
3. Use a Content Delivery Network
A content delivery network is essentially a series of data depots that store copies of some files. When a user makes a request the requested data is pulled from the depot nearest to the client, shaving milliseconds off of site load times.
*Linda’s note: There are a number of free and enterprise CDN’s out there like CoralCDN (free), Akamai and Strangeloop Networks.
Preberite celoten članek : 3 Tips for a Faster Website
Ni komentarjev:
Objavite komentar