How does Js call local applications and Js call applications?

Source: Internet
Author: User

How does Js call local applications and Js call applications?

Generally, the browser cannot directly interact with other programs on the local machine. In IE, we can use ActiveX objects. However, this method only applies to IE browsers. Another common method is the URL protocol. We register a URL protocol to a program for processing, such as tencent: // This protocol is registered with the QQ program for processing. When the browser needs to access this Protocol, it is transferred to the QQ program for processing. This URL protocol can be used across platforms. For example, you need to add a registry key on Windows.

First, let's look at how js calls the qq client.
 Window. Open ("tencent: // message /? Uin = 346915968 ")
Window. open. Don't talk about Tencent. bat t. The above dialog box can be opened directly for the qq account. We can see how the online customer service function on the Web page is implemented.
What should I do if I want to log on to qq without opening a dialog box? Very simple:
 Window. Open ("tencent: // message /? Uin = qq ") However, browsers generally prohibit the calling of applications, which is similar to that of hackers,

After you select allow,


When the application is started, the qq client is started.
Why do I need to talk about this? The boss gave me another requirement. I wanted to call the qq client and use a button on the demo page to call various programs of the ticket sales system...
Let's talk about nothing. Let's first look at what a custom protocol is.
Pluggable Protocol, also called URL Protocol, is sometimes called a Shell command. common protocols include http, ftp, and mailto. These are the built-in protocols for windows installation.
Then implement a simple custom protocol.
1. Run window and enter regedit to open the registry. Create a table named by yourself under HKEY_CLASSES_ROOT.
 
Add values in the following format:

Jsopen QQ music .exe


 
 
Start the application



End.

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.