On the application technique of instant paging technology in the Web

Source: Internet
Author: User
On the web (the one that does not consider using ActiveX controls) Instant paging is generally based on "pull" technology, that is, every once in a while to the server to get the latest news, and then reflected to the client, based on "pull" technology, generally there are several forms:

Frame/iframe refresh: Typically with a hidden iframe/frame page, timed refresh, get the latest message from the server, and execute the script to reflect the message to the client.
The benefits of this approach are good compatibility, for all support frame and script browser, the disadvantage is that because it is a direct refresh of the page, it is possible on some machines each refresh will have "click" Sound, if the browser status bar is visible, the above progress bar will flash a flash, more annoying. Microsoft's latest MSN Web Messenger, for example, is based on this technology.

Xmlhttp/xmldom No refresh: This technology has once made web developers very excited. At the client, XMLDOM can get the server-side XML file from the URL and return it as a XmlDocument, while XMLHTTP can not only get XML and HTML, but also send a XmlDocument to the server, and A timer that combines client script: settimeout ("Function ()", timeOutInterval), which periodically fetches data from the server.
In particular, it's important to note that whether it's xmldom or XMLHTTP, there are "synchronous" and "asynchronous", if it is "sync", then the browser will wait until the acquired XML has been downloaded to continue to execute, if it is "asynchronous", the browser will continue to follow the next step regardless of whether it has finished downloading. For Web instant paging, it is also recommended to use the "asynchronous" approach, because the "sync" method is likely to cause the browser "suspended animation" situation, the customer is very unfriendly. You can avoid this problem by using asynchronous, and you can then determine if the onReadyStateChange event has finished loading and then parse the message.
The advantage of this approach is that the customer does not feel the browser is refreshing, the disadvantage is that the client must be IE, and the installation of MSXML, so compatibility is not very good.
BTW: I heard that asp.net 2.0 for this no refresh was encapsulated, unfortunately did not try, do not know how compatibility:

Script Call WebService No refresh: WebService is a good thing, JS can also call Webserice, Microsoft has a special WEBSERVICE.HTC, will be the webservice of the call to the encapsulation, can be very convenient to call, in fact, even if there is no webservice.htc, we can also own to resolve, because WebService essence is the XML, In the client can be combined with xmldom to resolve. Then, with the help of timers, you can get server-side messages without refreshing.
The pros and cons of this approach are similar to the second approach. There is a chat room abroad is the use of this technology.

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.