In the web environment (excluding ActiveX controls), real-time paging is generally based on the "pull" technology, that is, obtaining the latest message from the server at intervals and then reporting it to the client, based on the pull technology, there are several forms:
Frame/iframe Refresh: Generally, a hidden IFRAME/frame page is used to regularly refresh, obtain the latest message from the server, and execute a script to reflect the message to the client.
This method has good compatibility and is suitable for all browsers that support frame and script. The disadvantage is that the webpage is refreshed directly, some machines may have a click sound every time they refresh. If the browser status bar is visible, the progress bar above will flash and be annoying. For example, Microsoft's latest MSN Web Messenger is based on this technology.
XMLHTTP/xmldom refreshing: This new refreshing technology once excited web developers. On the client side, xmldom can obtain the XML file on the server based on the URL and return an xmldocument. XMLHTTP can not only obtain XML and HTML, but also send an xmldocument to the server, combine the timer of the client script: setTimeout ("function ()", timeoutinterval) to regularly obtain data from the server.
In particular, whether it is xmldom or XMLHTTP, there are "synchronous" and "Asynchronous". If it is "synchronous ", the browser will wait until all the obtained XML files are downloaded. If it is "Asynchronous", the browser will continue the Next Step regardless of whether the XML files have been downloaded. We recommend that you use the Asynchronous Method for Web instant paging, because the synchronous method may cause the browser to be "suspended" and is unfriendly to the customer. This problem can be avoided by using "Asynchronous", and then the onreadystatechange event can be used to determine whether the load has been completed, and then parse the message.
The advantage of this method is that the customer does not feel the browser is refreshing, but the disadvantage is that the client must be IE and MSXML is installed, so the compatibility is not very good.
BTW :)
WebService calling by script is refreshing: WebService is a good thing. js can also call webserice. Microsoft has a dedicated WebService. HTC encapsulates WebService calls, which can be easily called even if there is no WebService. HTC, we can also resolve it by ourselves, because WebService is actually XML, and XML can be used in combination with xmldom on the client side. With the help of the timer, you can also get messages from the server without any need.
the advantages and disadvantages of this method are similar to those of the second method. This technology is used in a chat room outside China.