Build webim step by step (5)-embed webim into the page

Source: Internet
Author: User

A simple webim has been developed in previous articles, but this webim is on an independent page. Today, webim is a version that can be embedded in its own webpage, you only need to add a fewCodeYou can embed a webim in the page. However, the webim function is simple at present. If you have any requirements, you can submit them in the comments or contact me through webim. In the future, online applications such as online network disks on the Yunxiang online software platform may be integrated.

Source code download

DownloadSource codeTo embed webim into the web page, follow these steps.

1. Copy the bin, app_data, and Yunxiang folders in release to the root directory of the website.

2. Add a reference on the page to be embedded in webim:

 <  Link  Href  = "Yunxiang/themes/default/skin.css"  REL  = "Stylesheet"  Type  = "Text/CSS"/> <  Script SRC  = "Yunxiang/json2.js"  Type  = "Text/JavaScript"> </  Script  > <  Script  SRC  = "Yunxiang/config. js"  Type  = "Text/JavaScript"> </  Script  > <  Script  SRC  = "Yunxiang/CORE. js"  Type = "Text/JavaScript"> </  Script  > 

3. Add the following code to application_start and application_end of Global. asax (if global. asax is not available, copy global. asax to the root directory of the website)

VoidApplication_start (ObjectSender,EventargsE ){// In ApplicationProgramCode that runs at startupYunxiang.Messagemanagement. Instance. initialize (context );}VoidApplication_end (ObjectSender,EventargsE ){// Code that runs when the application is closedYunxiang.Messagemanagement. Instance. Dispose ();}

4. Add the following configuration to the httphandlers node of Web. config:

 <  Httphandlers > <  Add  Path  =  "  Lesktop. aspx  "  Verb  =  "  *  "  Type  =  "  Yunxiang. lesktop  "  /> <  Add  Path  =  " Recevie. aspx  "  Verb  =  "  *  "  Type  =  "  Yunxiang. webim_receivehandler  "  /> <  Add  Path  =  "  Send. aspx  "  Verb  =  " *  "  Type  =  "  Yunxiang. webim_sendhandler  "  /> </  Httphandlers  > 

5. After webim is embedded into the page, you can start the session in the following two ways:

 
System. startchat ("User Name","Peer user name");

 
// If the user is not specified, it is entered at startup.System. startchat ();

6. FAQs

(1) Does embedding webim affect the page startup speed?

Because the core. js file must be referenced to embed webim, You need to download several more files after embedding webim. However, as long as the session is not started, the webim-related script (window. JS, controls. JS, desktop. JS, webim. (JS). It is loaded only when it is started for the first time.

(2) will webim insert DOM objects?

Webim does not insert any DOM object as long as the session is not started.

 

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.