Five simple and effective techniques for accelerating your Web page

Source: Internet
Author: User
Keywords Acceleration five for you Java can

It's very important for Web pages to be loaded as fast as possible; users want to quickly view the pages they want to see, and if you can't satisfy them, they'll find another place. In this article, you will see five of related discussions about simple and effective techniques for accelerating your Web page.

1. First load CSS last loaded http://www.aliyun.com/zixun/aggregation/33906.html ">javascript

Some sites, you simply cannot avoid all HTTP requests that disrupt your functionality.

In this regard, the following recommendations:

In the body of the "head" tag in the Add CSS

Load JavaScript before the "/body" tag closes.

What's going to happen? The Web page is loaded on the user's machine, so their eyes begin to scan the provided interior, and this time JavaScript just catches up in the background to load. I

Tip: If you don't want to move JavaScript tags, you think it will mess up the way the site works, I recommend using the defer attribute. Usage is as follows:

<script defer= ' defer ' >

2. Adding an Expires Header

Some sites are very rich, and even with the above technology, performance seems to add more.

A user visits your website, produces some necessary pages, pictures, scripts and other HTT requests.

When you use the Expires Header, you can cache these elements on the user's local machine, not only increasing their access speed, but also saving you bandwidth. The Expires header can be used on all images, scripts and CSS.

Just add a line of code to your site's root directory, htaccess file. (If you don't, you can create one with a text editor, Save As. htaccess, and upload it to the root directory.) )

The following. htaccess. ico,. PFD,. flv (Flash type file),. jpg,. png, etc. set a remote term of 2010 due.

<filesmatch "\. (ico|pdf|flv|jpg|jpeg|png|gif|js| CSS|SWF) $ >
Header set Expires "Thu, APR 20:00:00 GMT"
</FilesMatch>

Note: If you set a expires header that is too remote, you will need to rename your update file (version it) otherwise users who use the cache won't be able to see the update.

For example, if you have a avascript file that needs to be updated, use the version number and then update all the older versions (i.e.. Javascriptfile-1.0.js, Javascriptfile-1.1.js)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.