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?
- 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.
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
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.
function pull () (
var s = document.createElement ( 'script');
document.getElementsByTagName ( 'head') . appendChild (s);
window.onload = pull;
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.
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.
Related Posts of Web site speed program
A server simultaneously run multiple different versions of Rails application [to Taiwan thegiive article]
http://lightyror.thegiive.net/2007/04/rails-version.html, following its original content. Rails site now using, Version divided into several faction. 0.x 1.0 1.1 1.2 Rails 0.X is a few years ago began to use the Rails at the ancestor of the domestic ...
html: Hyperlink Text Markup Language, used to display text in some format in the browser. On the page displays the effect of control is not strong. More difficult to make a more beautiful more dynamic effect, the text was transmitted to the client ca ...
Firebug Guide (four) --- how to use the Firebug command line API to provide debugging js procedures (below)
Introduction: Firebug command line are in one of the most useful features. If you have been using Visual Studio (referred to as VS) the experience of development projects, they should know you in the use of VS debugging procedures, "the immediate win
Rule 1. To reduce the number of HTTP requests 80% of the end-user response time spent on front-end process, but most of their time is spent on the various page elements, such as images, style sheets, scripts, and Flash, etc. of the download. To reduce the
XMLHttpRequest object components are XMLHttp through this object, Ajax can be the same as desktop applications with the server only the exchange of data layers without having to refresh every time interface, the data do not have to deal with each of ...
Rails applications easier to encounter two types of performance problems: Rails implementation of a class are very slow, CPU consumption too high; The other is the process of memory leaks Rails. To resolve these two types of questions are necessary before
/ / Open the model dialog box function doSelectUser (txtId) ( strFeatures = "dialogWidth = 500px; dialogHeight = 360px; center = yes; middle = yes; help = no; status = no; scroll = no"; var url, strReturn; url = "selUser.aspx"; strRetu