*. A brief introduction to HTC files

Source: Internet
Author: User
Tags html page object model reference return web services client
Htc

Today, on the forum, I see some brothers don't know what HTC is. Niche here to say a little bit.

Starting with version 5.5, Internet Explorer (IE) began to support the concept of web behavior. These behaviors are described by a script file with a suffix named. HTC, which defines a set of methods and attributes that programmers can apply to almost any element on an HTML page. Web behavior is great because they allow programmers to "connect" custom functionality to existing elements and controls, rather than having to have users download binaries (such as ActiveX controls) to do this. Web behavior is also a recommended way to extend the IE object model and control set. Microsoft offers several custom Web behaviors in the DHTML Behavior Library section of its developer site. I'll discuss a relatively new web behavior in this article: WebService behavior.

Web services are methods of passing parameters and receiving return values through an open, Simple Object Access Protocol (SOAP) to provide interface-independent software services on the Web. There are many examples and articles on the Internet that help you create Web services and use them from traditional windows-based applications or on the server side, but you can also use WebService behavior to use Web services on a client's browser.

The benefits of invoking a Web service from a client browser include the ability to get faster response times for the server, resulting in more interactive pages and more fun for users. Unlike the traditional use of the form back to the server and then receive a new page (this process includes downloading pictures and other content), WebService behavior uses XMLHTTP to send and receive only content related to the transaction process in the background, The content can then be displayed through DHTML and scripts.

The only browser I know that currently supports web behavior is ie; developers know to avoid using features that can only be used on IE. But the consortium has this CSS extension in its work draft as a future standard.

If you decide to use Web behavior now, you can use the following JavaScript function to detect whether the client supports this feature:

function Canusebehaviors () {

var ua = window.navigator.userAgent;

var msiepos = ua.indexof (' msie ');

var msiever = 0;

var behaviorsavailable = false;

var ihandle = 0;

if (msiepos >= 0) {

Msiemajorver = parseint (Ua.charat (Msiepos + 5));

Msieminorver = parseint (Ua.charat (Msiepos + 7));

if (Msiemajorver >= 5) {

if ((Msiemajorver = 5) && (Msieminorver >= 5)) | |

(Msiemajorver > 5)) {

Behaviorsavailable = true;

}

}

}

return behaviorsavailable;

}

Using the above function, you can determine at run time whether you can use the WebService behavior to invoke the Web service and use IE's DHTML feature to display the results or send this form to the server for the server to complete the necessary operations, and then generate a complete page again. Using CSS syntax to add WebService behavior to an element does not affect browsers that do not support specific CSS properties.

Microsoft provides a good reference that programmers can use to better familiarize themselves with accessing Web services from the client. Developers can also find the necessary HTML component (*.HTC) files on the Microsoft site.

With the webservice behavior in the Client toolkit, developers can create richer and more interactive pages for Web consumers, which are the same as the capabilities of enterprise users who use Web services provided by large hosts or application based on form windows. This will help eliminate redundant code and enhance the user experience by improving response times for specific features provided by the service.

Reference Documentation: Here is a specific explanation of XML. Here is a partial example.

Author: Peng Yi, Professor of NetEase College (2003)



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.