Slimming scheme under Ajax+jquery frame

Source: Internet
Author: User

Friends who have used Ajax.NET know that using the framework, the release version generates more than 80K of script files. And the debug version is bigger. If the application of the scene is used in enterprise intranet,

The problem won't come out, and if the scene is the Internet, it's a big problem. And I am very unfortunate, chose, ajax+jquery+ internet application scene.

Problem:

1. Can be modified by: <asp:scriptmanager id= "ScriptManager1" runat= "Server" scriptmode= "release", Will ScriptMode

Set to release and configuration Web.config node <compilation debug= "True" > Set debug to False to generate webresource.js

At around 80K. But it is still very large.

2.jquery.js+ui.js add up to have more than 200K, this is a relatively scary thing.

Solution:

1. Since I have used only the HTML script from the server side to read ascx generated on the entire project, I now plan to discard the AJAX framework and use JavaScript to access WCF directly to the server side.

Maybe someone asked, why not webservice? Originally I intended to use the webservice, but later came across a strange question asking for login. And my webservice is in the Web server,

Access the page without having to log on. After giving all the permissions to the directory, and so on many attempts fruitless, decide to use WCF.

2. After 1 of the transformation, although significantly reduced the webresource.js, but jquery.js+ui.js over 200K size can not be belittled. The first thing to do is to compress in IIS in a way that gzip.

But after the test, the effect is not obvious. Later decided to load the resource asynchronously. Pages and resources are downloaded in parallel. Rather than serial downloads.

However, there is a problem with this approach, because, if the asynchronous download, such as: A.js,b.js two files, if b.js have a place to use the functions in A.js, then, because the asynchronous download

That would be the case when the A.js function is executed in the b.js, but the a.js is not yet fully loaded. The only solution is to let them download sequentially. And how do you get them to download sequentially?

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.