Five dead corners that JavaScript providers should pay attention

Source: Internet
Author: User

Today, more and more people are using widgets on their websites. More and more people are installing third-party code support to display their websites or blogs such as Flickr photos, Twitter status, and iTunes playlists, these increasing widgets, although only about 1% of them are useful, have improved the overall internet landscape.

However, the emergence of widgets also brings about a problem: Using widgets will reduce the speed of your website. In better cases, your widgets comes from a stable and fast server. Worse, your widgets comes from an unstable server, it will have a great impact on your website.

A foreign blog author believes that there is no silver bullet in this regard, and there is no separate method or technology to solve this problem. This is a problem related to many aspects. Companies can use some methods to mitigate the impact of Multiple widgets. However, when the number of widgets reaches a certain level, the problem will always happen. The following are some considerations for javascript providers:

1. Delayed JavaScript Execution

All JavaScript code is expected to run in the first place, but it does not actually work. This is a very common problem. If the script does not need to be changed when the page is read, the script can be executed after the page is read. In this way, the page content can be displayed first. Unfortunately, this is not to say that some Browsers Do This.

2. Reduce the Running Load

When reading a page, everything slows down, so the less code the faster. In addition, it is associated with the entire page search, which causes slow reading of the entire page. In general, any JavaScript program running for more than five seconds will be faulty.

3. Load Balancing requests generate different URLs

Many modern scripts always return the same URL. With the wide application of widgets, the number of concurrent requests on the same server is huge. A better way is to distribute different URLs. Although different URLs can execute the same domain name, it will be a distribution in the future to distribute the browsing pressure.

4. Use a standard library

The worst possible thing is to start everything from scratch, because JavaScript is particularly prone to errors. As in Java, many standard libraries are set in JavaScript, and the standard may be more effective. The original libraries are written by experienced persons who understand system defects, so it is best to use them directly.

5. Think more.

It is important to know that some JavaScript will run on the end user's website. You must know that we are only part of a large system. Development is now able to reduce the possibility of damaging other Widgt, it can also ensure the quality of user experience.

Related Articles]

  • Use Javascript to evaluate the user's password input strength
  • Compile JavaScript code using function Programming Technology
  • PHP + JavaScript to dynamically display the server running progress bar (cool)

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.