How to improve website speed of 6 kinds of front-end optimization website

As a general point of view, a visit to the site to open fast and slow speeds, full use of this site is to look at the configuration space, if the configuration of this space hosts good, then your website will soon access speed; contrary, if your host sucks configuration space, then your website will be very slow access speed. In fact, space blows host configuration factors aside; you can also start from the web production areas, thereby increasing the speed of the site visit from the existing resources. If you do not know how to optimize website to improve access website speed, then look at the six kinds of website optimization O ring method front of it, I hope you can help!


How to improve website speed to optimize website


1) Use browser’s cache js and CSS files:


Add the following code in the web root directory .htaccess



ExpiresDefault “accessplus1year”


This code is meant to jpg | gif | png | css | js send header when caching headers, caching for one year, do not use ctrl + F5 to force a refresh in the browser cache to the time would have been the end, the only regret if you change the js or css file must replace the previous path or file name changes, it can be base.js? ver = (x) in this way next time the browser will automatically read and cache.

Improve website speed


2) Replace library file address into GoogleCDN .js address:


With the use of jquery and mootools and other js libraries to be loaded. js file is also growing more and more often the traditional site is uploaded to the site itself directory. But for a close more than 70 KB of jquery.js volume does not help improve the response speed of the site, in which case you should use Google API.


For example: You want to do a mall site, in the construction of the mall site, put your http: //www.***.com/jquery.xxjs replaced /1.4.4/jquery.min.js, in the sense that when a user visited the site after using Google api again call the api to access other sites do not need to load the address of the file once again. So as to achieve the purpose of speed.


Not only is the jquery library, others, such as mootoolsyui can also be used in this way.


3) Streamline and optimize  js and CSS:


Even with caching, but for js and css optimization but also necessary. We wrote the script and css javascript code is through indentation and line breaks, and suitable for human reading, but the browser and execute these scripts do not need these meaningless spaces and line breaks. Therefore, we should remove the line breaks that some spaces, and even shorten JavaScript and css inside variables. Optimization tools such as these have YUICompressor and ClosureCompiler. Both tools are java-based, use should be installed jdk and set JAVA_HOME. (For non-programmers site administrators is a bit difficult)


This tool cannot be installed on the local jdk, directly upload js and css files are compressed, you can choose is to use YUICompressor or ClosureCompiler.


4) GZIP compresses JS and CSS files:


Compressed js and css scripts dynamically through server can also simpler to use apache server in the site root directory. htaccess add the following code


AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application / json



Meaning of this code is to call the server over file compression module before output GZIP compression, gzip compressed after all files should be able to reduce more than 30% of the volume.


5) Using csssprites merge pictures


A website often use small icons and small images landscaping, but unfortunately these small images take up a lot of HTTP requests, so you can use sprites way to put all the images combined into one picture, you can merge related tools online, you can also ps merge.


6) To optimize website images:


A lot of pictures and icons used although the effect can bring to the site beautiful, graphic mixed is a very beautiful show Bowen method. Volume picture may indeed not to force, jpg is a lossy compression format, though png is lossless, but regret is the volume considerably. In order to reduce the volume of images to achieve the fastest download speeds, each picture should be optimized prior to uploading about volume.

Leave a Reply