Method for starting local application by browser and storage medium
By introducing local proxy services between the browser and local applications, the standardized communication protocol solves the security risks and compatibility issues brought by custom URI Scheme, and realizes the process of launching local applications in a secure and consistent browser.
Patent Information
- Application Number
- CN202510562728.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-07-01
AI Technical Summary
In the prior art, custom URI Scheme is used to launch local applications by browsers with security risks, and cross-platform compatibility and consistency are difficult to achieve.
Using local proxy services as the intermediate layer, interact with browsers and local applications through standardized communication protocols (such as HTTPS), record and verify relevant parameters to ensure security and compatibility.
Improves the security and cross-platform compatibility of browser launching local applications, avoids malware attacks, and ensures the integrity and consistency of instruction execution.
Smart Images

Figure CN120238571A_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of network security technology, and particularly to a method for a browser to launch a local application and a storage medium. Background Art
[0002] With the evolution of network technology, browsers have evolved from simple web display tools to feature-rich platforms. Many websites and web applications hope to enhance the user experience by invoking local applications (such as file access, system hardware control, etc.).
[0003] In the prior art, solutions such as URI Scheme are adopted. URI Scheme is a method for defining how a specific application responds to a specific URI format. By defining a specific URL format (such as "myapp: / / "), the locally installed application is triggered. This method is simple and easy to implement.
[0004] However, the use of custom URI Scheme may increase the security risks of the system. Malware may use the custom Scheme to perform unauthorized malicious operations, increasing system risks. Moreover, different Linux distributions and desktop environments may have inconsistent support and processing methods for URI Scheme, making it difficult to achieve compatibility and consistency across different environments when implementing custom URI Scheme in cross-platform applications. Summary of the Invention
[0005] To overcome the technical problems existing in the related art, this specification provides a method for a browser to launch a local application and a storage medium.
[0006] According to the first aspect of the embodiments of this specification, a method for a browser to launch a local application is provided. The browser runs on a device, and the local application is installed on the device. The method is applied to a local proxy service running on the device, and the method includes:
[0007] Receiving the relevant parameters sent by the browser for launching the local application, recording the relevant parameters, and then replying to the browser with a received response;
[0008] Receiving the instruction sent by the browser to launch the local application, and launching the local application based on the relevant parameters.
[0009] Optionally, periodically sending a monitoring request to the local application, waiting to receive the response replied by the local application; obtaining the running status information according to the information carried in the response.
[0010] Optionally, when the running state is an abnormal state, synchronize the abnormal state to the browser and trigger a restart of the local application.
[0011] Optionally, close the local application according to an instruction sent by the browser to close the local application.
[0012] According to a second aspect of the embodiments of the present specification, a method for a browser to start a local application is provided. The local application is installed on the device, and the method is applied to the browser running on the device. The method includes:
[0013] Send an inquiry request to at least one predefined port, where the high port is a port that is preset to be listened to by a local proxy service running on the device;
[0014] If a response message returned to the inquiry request based on any one of the predefined ports is received, record the any one of the predefined ports as the port used by the local proxy service;
[0015] Send relevant parameters for starting the local application to the local proxy service through the high port to instruct the local proxy service to start the local application based on the relevant parameters.
[0016] Optionally, if the browser does not receive a response corresponding to the request, jump to the download page of the local proxy service.
[0017] Optionally, send an instruction to close the local application to the local proxy service to instruct the local proxy service to close the local application.
[0018] According to a third aspect of the embodiments of the present specification, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, any of the above-mentioned methods is implemented.
[0019] According to a fourth aspect of the embodiments of the present specification, an electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, any of the above-mentioned methods is implemented.
[0020] According to a fifth aspect of the embodiments of the present specification, a computer program product includes a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of any of the above-mentioned methods are implemented.
[0021] The technical solutions provided by the embodiments of the present specification may include the following beneficial effects:
[0022] By adopting the design of using a local proxy service as the middle layer, with security, compatibility, and reliability as the core, this application avoids the problem in traditional solutions where relying on a custom URI Scheme may be exploited by malware to perform unauthorized operations. At the same time, through an automated process and communication based on a standardized communication protocol, it complies with the W3C standard, solves the adaptation problem in different operating systems or environments, and enhances cross-platform compatibility.
[0023] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and do not limit this specification. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings herein are incorporated into the specification and form a part of this specification, showing embodiments consistent with this specification, and are used together with the specification to explain the principles of this specification.
[0025] Figure 1 is a schematic diagram of a browser launching a local application provided by this application;
[0026] Figure 2 is a flowchart of a browser launching a local application provided by this application;
[0027] Figure 3 is another flowchart of a browser launching a local application provided by this application;
[0028] Figure 4 is a complete example diagram of a browser launching a local application provided by this application;
[0029] Figure 5 is a schematic diagram of the structure of an electronic device provided by this application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0030] To enable those of ordinary skill in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the drawings.
[0031] As Figure 1 shown, Figure 1 is a schematic diagram of a browser launching a local application provided by this application, including: device 101, browser 102 running on the device 101, and local proxy service 103 and local application 104 installed on the device 101.
[0032] Device 101 serves as a carrier to provide a running environment. This device can be a user host that hosts the installation and execution of browser 102, local proxy service 103, and local application 104.
[0033] The browser hopes to directly launch local applications, enabling users to directly call local software when using web applications without leaving the browser environment, achieving seamless connection between web pages and local applications, reducing the trouble of switching between different software for users, and thus improving the user's usage efficiency and convenience. In the prior art, the URI Scheme solution is adopted, where a specific Scheme is used to trigger the locally installed application to achieve the purpose of the browser launching the local application.
[0034] However, the use of custom URI Schemes in this solution may increase the security risks of the system because malware may take advantage of this to perform malicious operations, and different Linux distributions and desktop environments (such as GNOME, KDE) may have different support and processing methods for URI Schemes, resulting in the invalidation of the Schemes registered in some systems, making it difficult to achieve compatibility and consistency across different environments.
[0035] Since the W3C standard does not allow browsers to directly launch native applications, this application adopts the method of installing a local proxy service as an intermediary to achieve the purpose of the browser launching the local application. The browser interacts with the local proxy service, and the local proxy service is used to launch the local application. In this process, the interaction between the browser and the local proxy service complies with the standard, and the local proxy service launching the local application also complies with the specification. By installing the local proxy service as an intermediary, the browser sends relevant launch instructions to the local proxy service, and the local proxy service starts the local application according to the instructions to formally achieve the purpose of the browser launching the local application.
[0036] As Figure 2 shown, Figure 2 is a flowchart of a method for a browser to launch a local application provided by this application. The method is applied to the local proxy service and includes the following steps:
[0037] In step 201, receive the relevant parameters sent by the browser for launching the local application program, record the relevant parameters, and then reply to the browser with a received response.
[0038] The local proxy service receives the relevant parameters for starting the local application sent by the browser. The relevant parameters include: the installation path of the local application, for example: Windows: C:\Program Files\Client\app.exe or Linux: / opt / client / bin / app. The additional parameters passed during startup, such as enabling the debug mode, specifying the configuration file path, etc. The security verification information, which is used to ensure that the startup request sent by the browser is reasonable and legal and prevent unauthorized calls, such as a token or an API key for authentication. The platform adaptation parameters, which are used to dynamically adjust the configuration for different operating systems, such as the path formats \ for Windows and / for Linux, and environment variables such as the temporary directory and the system library path.
[0039] After receiving the relevant parameters, the local proxy service records them. The role of recording the relevant parameters is as follows: It can achieve the decoupling of the browser and the local application. The local proxy service, as an intermediate layer, records the complete relevant parameters. Subsequently, the browser only needs to send simple instructions without repeating the transmission of the complete parameters, solving the problem of inability to persistently save the configuration and improving the data transmission efficiency. It can ensure the integrity and consistency of the instruction execution. If the relevant parameters need to be re-transmitted every time the browser is started, there may be problems such as parameter duplication (duplicate transmission of the path) or parameter loss (such as context loss). After the local proxy service directly records the relevant parameters, it ensures that the configurations for multiple starts of the local application are consistent, avoiding application startup failures caused by parameter transmission problems. It can verify the security and control permissions. After the local proxy service records the relevant parameters, subsequent instruction requests sent by the browser need to pass through the security verification of the local proxy service to ensure the legality of the instruction requests and improve security. It can ensure cross-platform compatibility. After the local proxy service records the relevant parameters, it can dynamically convert the format according to the current operating system to dynamically adapt to various platforms, enhancing compatibility.
[0040] In one embodiment, the relevant parameters include parameter type extensions. In addition to basic parameters such as the installation path and security tokens, dynamic environment parameter support can also be added. Such as environment variable injection. When the local proxy service starts the local reference program, it dynamically injects system environment variables (such as the TEMP directory path, language settings, etc.) into the execution environment of the local application program to ensure that the local application program can run normally in different users' environments. Context-related parameters, such as a session ID, are generated by the browser and transmitted to the local proxy service. The local proxy service binds it to the local application program process for subsequent status tracking and resource isolation.
[0041] In another embodiment, the relevant parameters further include the parameter storage structure design, and a key-value pair database or in-memory cache is used to store the parameters. For example, for Redis cache, the high-performance feature of Redis is utilized to store the parameters, and the TTL (time to live) is set to avoid data redundancy. Or a local SQLite database can be adopted, which is suitable for lightweight scenarios, and the atomicity of parameter records is ensured through the transaction mechanism to guarantee the consistency of relevant data.
[0042] In another embodiment, the relevant parameters further include enhanced security verification. For example, for two-factor authentication, in addition to the above-mentioned Token and APIKey, a dynamic verification code (such as TOTP) can be added for verification to further prevent unauthorized access caused by token leakage. Also, for parameter signature, the browser signs the parameters with a message authentication code based on a hash function (such as HMAC-SHA256), and the local proxy service can perform the operation of starting the local application after verifying the legality of the signature.
[0043] In step 202, receive the instruction to start the local application sent by the browser, and start the local application based on the relevant parameters.
[0044] The local proxy service receives the instruction from the browser to start the local application. The parameters in this instruction include but are not limited to the file path parameter (such as C:\Program Files\Client\app.exe), the security verification parameter (such as Token = 123), the control instruction (execute = start), etc. The local proxy service verifies according to the parameters and the recorded relevant parameters, and can block illegal instructions and safely start the local application.
[0045] In one embodiment, the local proxy service periodically sends monitoring requests to the local application. After the local proxy service receives the start instruction and successfully starts the local application, a timer is immediately started to periodically send monitoring requests (doQuery instructions). The monitoring interval is set internally by the local proxy service. For example, it can be sent once every 3 seconds, once every 5 seconds, etc. This application does not make any requirements for the setting of this time interval.
[0046] The local proxy service waits to receive the response replied by the local application, and obtains the running status information of the local application according to the information carried in the response. The response replied by the local application includes but is not limited to "Connected", "Stopped", etc. The local proxy service can know the status of the local application, such as connected or disconnected, based on these responses.
[0047] In another embodiment, if the running status information of the local application is an abnormal status, for example, the response returned by the local application is "Disconnected" or "SecurityAuth", etc., it indicates that the local application has an abnormality. At this time, the local proxy service sends this abnormal status to the browser and restarts the local application. This method enables the user to obtain the running status of the local application through the browser, avoiding repeated or incorrect operations by the user due to unknown status.
[0048] In one embodiment, the local proxy service can also receive an instruction from the browser to close the local application, and then closes the corresponding local application according to the instruction.
[0049] As Figure 3 shown, Figure 3 is another flowchart of the browser starting the local application provided by this application. The method is applied to the browser and includes the following steps:
[0050] In step 301, an inquiry request is sent to at least one predefined port, and the high port is a port preset to be listened to by the local proxy service running on the device.
[0051] The browser sends an inquiry request to at least one predefined port. This request is used to determine whether the port is listened to by the local proxy service. The port listened to by the local proxy service is usually preset as a high port. The low port is usually occupied by system-level services, and ordinary user programs do not have permission to listen. While high ports allow users and programs to use freely, away from common ports, which can effectively avoid port conflicts.
[0052] In step 302, if a response message is received based on any one of the predefined ports for the inquiry request, then record this any one of the predefined ports as the port used by the local proxy service.
[0053] The browser has sent an inquiry request to at least one port. When a response is received from any one of the ports, it indicates that this port is the listening port of the local proxy service. The browser can send the relevant parameters for starting the local application to the local proxy service through this port.
[0054] In step 303, the relevant parameters for starting the local application are sent to the local proxy service through the high port to instruct the local proxy service to start the local application based on the relevant parameters.
[0055] After the browser determines the port listened by the local proxy service, it sends the relevant parameters for starting the local application to the local proxy service through this port. When the browser sends an instruction to start the local application, the local proxy service can match the received instruction with the recorded relevant parameters to achieve the purpose of safely starting the local application.
[0056] In one embodiment, the browser installs a local application management module. The local application management module is one of the core components for realizing the interaction between the browser and the local application. Specifically, it is a JavaScript module embedded in the browser page, responsible for coordinating the communication and control among the browser, the local proxy service, and the local application. Its essence is a piece of JS code running on the browser page, which interacts with the local proxy service through the standardized HTTPS protocol. The functions of the local application management module include but are not limited to: discovering the local proxy service, guiding the user to install the local proxy service, obtaining the relevant parameters for starting the local application, and handling abnormal states.
[0057] In another embodiment, the local application management module can discover the local proxy service and establish a connection with it. The local application management module will try to send connection requests to the preset high-end ports of the local proxy service (such as 65432, 65441, 65450), and make multiple attempts (such as 10 times) to automatically identify the actual listened port of the local proxy service and solve the port conflict problem. If the port 65432 is occupied, it will automatically switch to 65441 or 65450 to ensure the success of the connection request. The preset high-end ports include but are not limited to the above three ports, and this application does not limit this.
[0058] In another embodiment, the local application management module guides the user to install the local proxy service. When the connection request sent by the local management module does not get a response, it means that the local proxy service has not been installed. At this time, the local application management module can guide the user to jump to the local proxy service download page for the user to install the local proxy service.
[0059] In another embodiment, the local application management module can obtain the relevant parameters for starting the local application. Specifically, the local application management module obtains the relevant parameters for starting the local application through two aspects: browser page interaction and environmental dynamic adaptation.
[0060] First, the local application management module obtains the parameters actively input by the user through page interaction. For example, the user fills in the local application installation path and server address in the input box provided on the Web page. The local application management module obtains the input value of the user through JavaScript and sends it to the local proxy service; URL parameter passing, directly passing the configuration through the link (such as the sharing link).
[0061] Second, the local application management module dynamically adapts to obtain parameters according to environmental changes. For example, it automatically generates the local application path based on the user's operating system type (Windows / Linux). If the user does not manually fill in the path, the local application management module will automatically use the matching path. The local application management module will dynamically generate a unique session identifier (SessionID) and send the unique session identifier to the local proxy service in the form of an instruction. When the local proxy service starts the application, it will bind this unique session identifier, which is convenient for subsequent status monitoring and resource management of the local application program. The local application management module can also dynamically obtain security credentials. For example, security-sensitive information such as Token is dynamically generated by the backend API. The local application management module obtains the Token from the port through an Ajax request. Subsequently, when sending an instruction to start the local application program to the local proxy service, the local proxy service can verify the legitimacy of the Token and decide whether to start the local application program.
[0062] In another embodiment, the local application management module can handle the abnormal state of the local application program. The local application management module periodically sends monitoring requests to the local proxy service, enabling the local proxy service to monitor the local application program according to the monitoring requests and synchronize the monitoring status to the local application management module. The local application management module will then process the status information.
[0063] In one embodiment, the local proxy service and the local application management module communicate using the HTTPS protocol. First, the HTTPS protocol has high security. Through SSL / TLS encryption transmission, it prevents sensitive information (such as local application paths and security credentials) from being stolen or tampered with. The local proxy service only responds to requests from the local machine and combines dynamic Token verification to check the legitimacy of requests, thereby enhancing security. Second, the HTTPS protocol has high cross-platform compatibility. It is supported by all modern browsers and operating systems, eliminating the need to adjust the logic for different platforms (such as different Linux distributions). Subsequently, the HTTPS protocol complies with the W3C standard. The W3C prohibits browser pages from directly starting local application programs, but allows Ajax to send HTTPS protocol requests. The local application management module triggers the start or shutdown of the local application program through standardized HTTPS instructions (such as doExecute / start). Finally, the HTTPS protocol has flexibility and extensibility. It supports complex parameters, such as supporting the transfer of structured data in JSON format, etc., and is suitable for multi-configuration scenarios. There are various types of instructions, including doConfiguration, doQuery, doExecute, etc., to achieve parameter transfer, status monitoring, and lifecycle management.
[0064] Figure 4 as shownFigure 4 This is a complete example diagram of a browser launching a local application provided by this application, including the following steps:
[0065] In step 401, at the beginning, the user opens the browser page, and the page loads the local application management module (JS component);
[0066] In step 402, query the local proxy service. The local application management module sends an instruction to the port of the local machine and makes loop attempts (such as attempting 10 times);
[0067] In step 403, determine whether the local proxy service exists. The local application management module waits for the response of the local proxy service to the instruction. If a response is received, record the successful port number and enter step 405. If no response is received, enter step 404;
[0068] In step 404, download and install the proxy service. If the local application management module does not receive a response, it means that the local proxy service is not installed on the local machine. Then, it drives the browser page to jump to the local proxy service download page to guide the user to download and install the local proxy service;
[0069] In step 405, configure the local application parameters. After the local application management module detects the local proxy service, as a JavaScript module embedded in the browser page, it can directly interact with the user interface. According to the parameters such as the local application installation path manually input by the user or directly passing the configuration parameters through the page link, send the obtained relevant parameters to the local proxy service; after receiving the relevant parameters, the local proxy service records the relevant parameters and replies with a response indicating that it has received the relevant parameters;
[0070] In step 406, start the local application. The local application management module sends an instruction to start the local application to the local proxy service. The local proxy service determines the legality of the instruction based on the recorded relevant parameters and safely opens the local application;
[0071] In step 407, monitor the status of the local application. The local proxy service regularly sends monitoring instructions to the local application, monitors the running status of the local application, and sends the status information to the local application management module;
[0072] In step 408, determine whether the status of the local application is abnormal. The local proxy service determines whether the running status of the local application is abnormal. If the status is normal, continue to monitor. If an abnormal situation occurs, enter step 409;
[0073] In step 409, restart the local application. The local proxy service performs a restart operation on the local application in an abnormal state and sends the relevant information after restart to the local application management module;
[0074] In step 410, the local application is closed. The local application management module sends a local application closing instruction, and the local proxy service receives the closing instruction to close the corresponding local application.
[0075] This application provides an electronic device. As Figure 5 shown, at the hardware level, the electronic device includes a processor 501, an internal bus 502, a network interface 503, a memory 504, and a non-volatile memory 505. Of course, it may also include other required hardware. The processor 501 reads the corresponding computer program from the non-volatile memory 505 into the memory and then runs it, forming an implementation device for starting the local application program at the logical level. Of course, in addition to the software implementation method, this specification does not exclude other implementation methods, such as logical devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logical unit, and can also be hardware or a logical device.
[0076] This application also provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the method for obtaining load information described in any one of the above.
[0077] This application also provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, they implement the method for a browser to start a local application described in any one of the above.
[0078] Those skilled in the art will readily conceive of other embodiments of this application after considering the specification and practicing the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include known common knowledge or conventional technical means in the technical field not disclosed in this application. The specification and examples are only regarded as exemplary, and the true scope and spirit of this application are pointed out by the following claims.
[0079] The above are only the preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of this application shall be included within the scope of protection of this application.
Claims
1. A method for starting a local application by a browser, characterized in that: The browser runs on a device, the local application is installed on the device, and the method is applied to a local proxy service running on the device, including: Receiving relevant parameters sent by the browser for starting the local application, recording the relevant parameters, and then replying a received response to the browser; An instruction for starting the local application sent by the browser is received, and the local application is started based on the relevant parameters.
2. The method according to claim 1, characterized in that Also includes: Periodically sending a monitoring request to the local application, and waiting to receive a response from the local application; The operation status information is obtained according to the information carried in the response.
3. The method according to claim 2, characterized in that Also includes: When the running state is an abnormal state, the abnormal state is synchronized to the browser, and the restart of the local application is triggered.
4. The method according to claim 1, characterized in that: Also includes: According to the instruction of closing the local application sent by the browser, the local application is closed.
5. A method for starting a local application by a browser, characterized in that: The local application is installed on a device, and the method is applied to the browser running on the device, including: Sending a query request to at least one predefined port, where the port is a pre-set port monitored by a local proxy service running on the device; If a response message returned to the query request based on any predefined port is received, the predefined port is recorded as a port used by the local proxy service; Sending relevant parameters for starting the local application to the local proxy service through the port to instruct the local proxy service to start the local application based on the relevant parameters.
6. The method according to claim 5, characterized in that Also includes: If the browser does not receive a response corresponding to the request, it jumps to the download page of the local proxy service.
7. The method according to claim 5, characterized in that Also includes: An instruction to close the local application is sent to the local proxy service to instruct the local proxy service to close the local application.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Method for remotely managing and controlling client management end, operation and maintenance manager and client management end
CN120499265A