Web site speed program

Visit the slow pace of the Internet has become the past, but the page can be instantaneous only the future will show what is happening. Christianheilmann some skills, you can now visit the site together smoother.

First visit to the page when the delay is the Web site and Web application design encountered a very important question. Users always feel the corresponding page, not fast enough.
Why is there such a feeling of the user? Users also may be many years ago to retain the kind of billing per minute of access network the way the use of customary (now the hotel or airport is also to maintain the kind of access); may be because users feel that the pages are enough to have quick response can be called the so-called information highway. But I think this is the responsibility of Hollywood. In each area of action in Hollywood: tapping the keyboard at the same time, the computer screen will appear on ultra-high resolution, with numerous data showing exquisite site interface; and Web site to read a short period, however encyclopedia a few milliseconds to complete.
But in real life is completely not true, because no matter how you try to simplify your page, the delay still exists. But in order to make the page more brilliant, usually using flash, but if the abuse of flash will seriously affect the page response speed. As a network application, it is also necessary to ensure that the loading order of page elements will not be because the page has not been completely loaded element is caused by abnormal user access.

What are the factors in response to the slow site?

When it comes to improve Web site response time, the most usual practice is to document as much as possible to reduce the site size. (This also led to JavaScript library file against the size of endless discussion, but finally the result is no.) In fact, there are many factors will affect the website in response to the speed of the initial visit:

  • The size of HTML documents.
  • Embedded in the page script, images, multimedia elements in the document size.
  • The complexity of the HTML page. (Browser can quickly demonstrate a simple page)
  • User's access speed
  • Will be the third-party content page where the server access.
  • Website with the domain name and the page contains an external domain name DNS to resolve the speed.
  • A user's computer performance. (Because the browser will consume excessive system resources to other tasks become slow to respond).
  • The corresponding speed of the server.

Apart from the above technical factors will lead to Web site in response to slow, there are a number of human factors design. For example: in order to avoid the page to load the page appear in the process of regional disorder and non-image display; page is designed to fully load the required page displayed after.

Website will allow quick response to Ways

After practice, because of the following experience in solving technical and man-made factors have slowed the site to respond to questions will be helpful.

  • Without affecting the quality of page, under the premise of optimizing the HTML code as much as possible. (Which is included in the release page, remove the HTML document in the Notes, as well as redundant tag line. However, in order to guarantee the readability of the page, the code should also be retained in the source code)
  • Page that contains the lowest possible number of other external reference, to reduce dependence between documents. (Can be multiple scripts into a script file, using the sprite techniques CSS multiple small images into one big map, so only need to load first)
  • To ensure that you do not have to quote from an external server the contents of a third party: using a script to a remote RSS sources in the local cache. This will not only avoid the DNS to resolve the delay caused by, but also because the external server will not affect your service downtime.
  • As far as possible the formulation of images and contains elements of picture size. This can be avoided because of the page to show when the picture after another page element load caused by the phenomenon of beating.
  • The end of the page to load a large script, this page can be loaded in the script prior to the completion of display. If you put a large script on the page to load the first element, the browser will wait until the script shows fully loaded until the page content.

web development guidelines and improve response speed

Unfortunately, these terms referred to above Qiao and we normally think of web development guidelines are in conflict. Page contains documents such as reducing the quantity of products will cause deterioration of maintainability. In order to make the site do not have the page (home page, article pages, archive pages) to maintain a different page style of the simplest way is to different types of pages stored in a special style of their own style file. A page can have a basic style file, then in accordance with the different types of page and then type the page that contains the specified style in document.
Stored script can also be used the same method to function in a similar script file. This will help the code maintenance. You do not see all the script code can quickly find the function you need. In addition, the script to add the main part of page is generally considered bad coding habits, because he will be the user's behavior control logic embedded in the structure of the page.

Fortunately, there are technical solutions can solve these problems.

Contains references to a number of styles or scripts.

Edward Eliot proposed solution is to use a PHP script will be a number of CSS styles or scripts collated into a single file. This script can also call the javascript for DouglasCrockford's the JSmin compressed. This script is very simple to use and can be integrated into the cache file until these have been integrated into the document been modified. This means that when you modify a file after the merge, the script will automatically re-packaged cache. This very simple solution of the code maintenance and page conflict between response speed.

Solve the problem loading page

Another thorny issue is that the first element embedded in the page script and, if necessary, to wait for pages to load can be called upon completion. This will be some delay, but also create problems.

Delay is because of the browser to load, parse and display documents created by the way. When you use the window's onload event to load the script, the browser of the treatment sequence is as follows:

  • Analysis of HTML code loading external script and style sheet
  • Implementation of the scripts have been parsed
  • HTML set up the DOM tree
  • Loading images and other external reference content
  • Page has finished loading

In most cases this will be relatively slow to load, and some of the steps required in advance. Many clever programmers committed to resolve this issue, from time to time there will be new solutions arise. Most of the javascript script will have onDocumentReady for onAvailable or deal with the incident. Such incidents will be part of the document will be loaded after the completion of the trigger, rather than wait for a large number of photographs have been loaded. However, through practice and repeated tests, for the old browser and operating system did not watertight solution. But I believe as long as we continue our efforts, combined with luck it will find the ultimate solutions.

For web applications did not load because of call completion and lead to abnormal elements are very deadly problem. If these problems happen to beautify parts of the page, there are some solutions.

Too much time to load in order to solve the content problem, you can adopt on-demand content is loaded separately.

In order to better decorative page loading time a lot of content, often have questions. May have substantial contents of each tag contains too many characters have 4 or a navigation bar. Use javacript script can easily display dynamic content. However, if the script is disabled, dynamic content will lose these styles have been disrupted and can not properly displayed, and this is not a good idea. Page there is no need for a dynamic display of all the contents of a load, this will increase the load on the page loading.

Solutions are triggered when a user tags when re-use javascript to load dynamic content display. When users turn off scripting will also be displayed after a basic static text.

How to load the extra content required depends on what you quoted is. The easiest way is to dynamically generate script tags. This is a very early method was used to introduce a lot of javascript data sets or re-introduced after the page loads the script.

function pull () (
var s = document.createElement ( 'script');
s.type = 'text / javascript';
s.src = 'largeJavaScriptBlock.js';
document.getElementsByTagName ( 'head') [0]. appendChild (s);
window.onload = pull;

page on del.icio.us to the introduction of this method to return json data. Json But because of the back are a bunch of javascript code, you can load the page after the completion of javascript to generate a script tag that contains the code; then the implementation of these codes to replace the original page content of an element. Dishy as a json object encapsulates Allows you to easily complete these. Another Liezi are Less prominent portrait Flickr , Flickr using json output shows you the latest photos, when a user disable script, which shows only the location of a link.

If you want to introduce a non-javascript, you can use Ajax or ahah Hijax or xml or other does not contain the ajax (referred to as what you are willing to put another name). For example, a Implementation using ajax navigation It can even necessary in accordance with the user can choose to load more complex interface.

Imaging trickery image display skills

Finally a method of origin will be traced back to contact you may have begun when the website development. Was the browser war in the most competitors ie plays the role of ill of Netscape (but I think that time is still good) browser support for a custom HTML attribute 'lowsrc', this property can specify a small picture ahead of time to load as large map loading alternative display picture. So even if the user's access speed is slow, we can see is about to show a preview picture.
You can reuse this idea, when the page is loaded, do not embed the picture is too large but more standardized loading small picture; such as the page loads after the completion of the replacement of large pictures. You can even simplify the time to start loading only the background color, and then complete the re-use, such as page loading javascript or DOM load cover artwork.
This approach also applies to a number of servers you need to get much of the picture should not be cached. (For example, gravatars) can often be a placeholder before loading the images, such as dynamic page is loaded after the completion of other servers to obtain dispersed in small picture.

分类:AJAX 时间:2009-03-05 人气:835
blog comments powered by Disqus


  • 7 large-scale web site design and maintenance of key skills 2010-07-30

    Collis Ta'eed once wrote a blog post " 7 Crucial Tips for Designing and Maintaining a Large Site ", for us to share the large-scale web site design and maintenance of key skills, alswl article has been translated into Chinese, is reproduced here

  • Use Javascript to obtain the location of page elements 2010-09-07

    Use Javascript to obtain the location of page elements Author: Ruan Yifeng Date: September 14, 2009 The process of making web pages, you sometimes need to know an element's exact location on the page. Javascript tutorial below summarizes the position

  • The structure of large-scale web site design 2009-07-30

    To see someone else write a large-scale web site design experience, want to have access to such sites. Baidu author from the collection will be referred to as load balancing "is a large-scale Web site to resolve the high-load access and a large numbe

  • Web site optimization to improve performance speed of the speed of access to 14 practice 2009-10-07

    Believe that the Internet has increasingly become an indispensable part of life. ajax, flex, etc. rich-client application makes it more "happy" to experience a number of the original only in C / S to achieve the function. For example, Google the

  • JSP dynamic web application design (II) 2010-03-29

    response objects and out object: response object: JSP is mainly used to pass back the results after processing the client, so that dynamic content as HTML code. That is response to customer requests for an object to make a dynamic response to the cli

  • Web architecture design experience-sharing 2009-07-11

    Author: Zhu Yi Source: http://www.cnblogs.com/yizhu2000/archive/2007/12/04/982142.html I as a web engineer, most of the focus is performance and structure, to participate in the Thanks sd2.0 General Assembly, to be wide-ranging exchanges with their p

  • Web site design to improve usability (effectiveness) of the 10 principles of 2008-08-24

    Decided the fate of the success of a site, not visual design, but the design and availability. Users to access web pages holding the mouse, decide everything, "user-centric" has already become the standard design direction for a successful web s

  • Skills in web site design 40 2011-01-05

    1. Oncontextmenu = "window.event.returnValue = false" will completely shield Right <table border oncontextmenu=return(false)> <td> no </ table> can be used for Table 2. <body Onselectstart="return false"> desele

  • Web Form Design: Form Structure 2011-09-08

    Do you feel too depressed who form the design or do not know it? The next three articles, hoping to completely change your opinion, really fell in love with Web form design. First of all thank Luke Wroblewski's help, I have the opportunity to design

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 闽ICP备15018612号

processed in 0.185 (s). 12 q(s)