Webpage processing method and device for instant messaging client, equipment and storage medium

By injecting code into the web page in the instant messaging client, establishing a communication channel and collaborating with the server for translation, the language barrier problem of users when reading web pages in the instant messaging client is solved, and convenient web content translation is achieved.

CN119906692APending Publication Date: 2025-04-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311402871.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-26
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

Users may experience language barriers when reading web pages in instant messaging clients, especially when the web pages are in English and the user's native language is Chinese.

Method used

By injecting code into the web page in the instant messaging client, a communication channel between the instant messaging client and the web page is established, a text to be translated sent by the web page is received, a translation request is sent to the server, a translation result is received and returned, and it is updated to the web page.

Benefits of technology

It realizes convenient translation of web page content opened in the instant messaging client, solving the problem of language barriers when users read web pages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119906692A_ABST
    Figure CN119906692A_ABST
Patent Text Reader

Abstract

The invention provides a webpage processing method and device for an instant messaging client, equipment and a storage medium. The method comprises the following steps: displaying a webpage corresponding to a webpage link in response to a trigger operation for the webpage link in the instant messaging client; injecting a code into the webpage, and establishing a communication channel between the instant messaging client and the webpage through the code; receiving a to-be-translated text sent by the webpage through the communication channel; sending the text to be translated to a server; receiving a translation result for the to-be-translated text returned by the server; and sending the translation result to the webpage through the communication channel so as to perform updating on the webpage based on the translation result. According to the method and the device, the problem of language barriers encountered when the user reads the webpage in the instant messaging client can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a web page processing method, device, equipment and storage medium of an instant messaging client. Background Art

[0002] With the development of Internet technology, instant messaging (IM) can be performed in a conversational manner. For example, user A can input an instant messaging message (i.e., IM message) in the conversation interface of an instant messaging client, and trigger the instant messaging message to be sent to user B, thereby realizing instant messaging between user A and user B. In addition, in order to convey more information, user A can also insert a web link in the instant messaging message sent to user B, so that user B can click on the web link to open the corresponding web page to learn more content. However, due to the diversity of web pages, the web page opened by user B may be an English web page, while user B's native language is Chinese, that is, user B may not be particularly familiar with English, resulting in language barriers for user B when reading web pages. Summary of the invention

[0003] The embodiments of the present application provide a web page processing method, device, electronic device, computer-readable storage medium and computer program product of an instant messaging client, which can solve the language barrier problem encountered by users when reading web pages in an instant messaging client.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application provides a web page processing method of an instant messaging client, including:

[0006] In response to a triggering operation on a webpage link in the instant messaging client, displaying a webpage corresponding to the webpage link;

[0007] Injecting code into the webpage, and establishing a communication channel between the instant messaging client and the webpage through the code;

[0008] receiving a text to be translated sent by the webpage through the communication channel;

[0009] Sending the text to be translated to a server;

[0010] Receiving a translation result for the text to be translated returned by the server;

[0011] The translation result is sent to the webpage through the communication channel, so that the webpage is updated based on the translation result.

[0012] The embodiment of the present application provides a web page processing device of an instant messaging client, comprising:

[0013] A display module, configured to display a web page corresponding to the web page link in response to a triggering operation on the web page link in the instant messaging client;

[0014] An injection module, used to inject code into the webpage, and establish a communication channel between the instant messaging client and the webpage through the code;

[0015] A receiving module, used for receiving the text to be translated sent by the webpage through the communication channel;

[0016] A sending module, used for sending the text to be translated to a server;

[0017] The receiving module is further used to receive the translation result returned by the server for the text to be translated;

[0018] The sending module is further used to send the translation result to the webpage through the communication channel, so that the webpage is updated based on the translation result.

[0019] An embodiment of the present application provides an electronic device, including:

[0020] A memory for storing executable instructions;

[0021] The processor is used to implement the web page processing method of the instant messaging client provided in the embodiment of the present application when executing the executable instructions stored in the memory.

[0022] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for implementing a web page processing method for an instant messaging client provided in an embodiment of the present application when executed by a processor.

[0023] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions, which are used to implement the web page processing method of the instant messaging client provided in the embodiment of the present application when executed by a processor.

[0024] The embodiments of the present application have the following beneficial effects:

[0025] When a user needs to read a web page in an instant messaging client, he can first inject code into the web page to establish a communication channel between the instant messaging client and the web page through the code. Then, after receiving the text to be translated sent by the web page through the communication channel, the instant messaging client can send the received text to be translated to the server, so that the server translates the text to be translated. Subsequently, after the instant messaging client receives the translation result returned by the server, it can return the translation result to the web page through the communication channel, so that the web page can be updated based on the translation result. In this way, the content of the web page opened in the instant messaging client can be conveniently translated, thereby solving the language barrier problem encountered by users when reading web pages in the instant messaging client. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 1 is a schematic diagram of the architecture of a web page processing system 100 for an instant messaging client provided in an embodiment of the present application;

[0027] Figure 2 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application;

[0028] Figure 3 It is a schematic diagram of mutual calls between an instant messaging client and a web page provided in an embodiment of the present application;

[0029] Figure 4 It is a flowchart of a web page processing method of an instant messaging client provided in an embodiment of the present application;

[0030] FIG. 5A to FIG. 5C It is a flowchart of a web page processing method of an instant messaging client provided in an embodiment of the present application;

[0031] Fig. 6A and Figure 6B It is a schematic diagram of an application scenario of the web page processing method of the instant messaging client provided in an embodiment of the present application;

[0032] Figure 7 It is a schematic diagram of the principle of the web page processing method of the instant messaging client provided in the embodiment of the present application;

[0033] Figure 8 It is a flow chart of a web page processing method of an instant messaging client provided in an embodiment of the present application. DETAILED DESCRIPTION

[0034] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0035] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0036] It is understandable that in the embodiments of the present application, related data such as user information (such as instant messaging messages and emails sent by users), when the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0037] In the following description, the terms "first\second\..." are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\..." can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0038] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0039] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0040] 1) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed may be in real time or have a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed may be executed.

[0041] 2) Hyper Text Markup Language (HTML): It is a markup language that includes a series of tags that can unify the document format on the Internet and connect scattered network resources into a logical whole. HTML text is a descriptive text composed of HTML commands. HTML commands can describe text, graphics, animations, sounds, tables, links, etc.

[0042] 3) Document Object Model (DOM): It is a standard programming interface for processing extensible markup languages. It is an application programming interface (API) that is independent of platforms and languages. It can dynamically access programs and scripts to update their content, structure, and style of World Wide Web (WWW) documents. DOM provides an access model for the entire document. The document can be viewed as a tree structure, and each node of the tree represents an HTML tag or a text item within a tag. The DOM tree structure accurately describes the interrelationships between tags in an HTML document. The process of converting an HTML or Extensible Markup Language (XML) document into a DOM tree is called parsing. After the HTML document is parsed, it is converted into a DOM tree, so the processing of the HTML document can be achieved by operating the DOM tree. The DOM tree not only describes the structure of the document, but also defines the behavior of the node object. Using the methods and properties of the object, the nodes and content of the DOM tree can be easily accessed, modified, added, and deleted.

[0043] 4) Web: Web pages are the basic elements of websites and are the platform for various website applications. A web page is a plain text file containing HTML tags. It can be stored in a computer somewhere in the world. It is a "page" in the World Wide Web and is in HTML format. Web pages usually use image files to provide pictures. In addition, web pages must be read through a web browser.

[0044] 5) Uniform Resource Locator (URL): It is a method of specifying the location of information on the World Wide Web service program of the Internet. Available resources on the Internet can be represented by simple strings. This document describes the syntax and semantics of such strings, which are called URLs. In other words, URL is an addressing method set up to identify the location of resources on the Internet. The web page link (or web page address) usually refers to the URL. The Uniform Resource Locator is a concise representation of the location and access method of resources that can be obtained from the Internet. It is the address of standard resources on the Internet.

[0045] 6) Native interface: refers to the interface developed using the native development language of each platform (such as Java for Android and Objective-C for iOS). The native interface can directly access various hardware of the terminal device (such as a mobile phone), such as the camera, microphone, etc., thus providing a richer and smoother user experience.

[0046] 7) H5 page: It is a page developed using web technologies such as HTML5, CSS3 and JavaScript. It is generally displayed through a browser or a web view (WebView) component. For example, the above-mentioned web page can be an H5 page. The advantage of the H5 page is that it is cross-platform. A set of codes can run on various devices and platforms, saving development and maintenance costs.

[0047] The embodiments of the present application provide a web page processing method, device, electronic device, computer-readable storage medium and computer program product of an instant messaging client, which can solve the language barrier problem encountered by users when reading web pages in an instant messaging client. The electronic device provided by the embodiments of the present application is described below. The electronic device provided by the embodiments of the present application can be implemented as a terminal device, or can be implemented by a server and a terminal device in collaboration. The following is an example of the web page processing method of the instant messaging client provided by the embodiments of the present application being implemented by a server and a terminal device in collaboration.

[0048] For example, see Figure 1 , Figure 1 1 is a schematic diagram of the architecture of a web page processing system 100 of an instant messaging client provided in an embodiment of the present application, which is used to implement an application that supports solving the language barrier problem encountered by users when reading web pages in an instant messaging client, such as Figure 1 As shown, the web page processing system 100 of the instant messaging client includes: a server 200, a network 300 and a terminal device 400, wherein the server 200 can be used to provide translation services, the network 300 can be a local area network or a wide area network, or a combination of the two, the terminal device 400 is a user-associated terminal device, and an instant messaging client 410 runs on the terminal device 400, wherein the instant messaging client 410 can be a personal instant messaging client (i.e., an instant messaging client that provides social services to personal users) or an enterprise instant messaging client (i.e., an instant messaging client that provides social services to enterprise users).

[0049] In some embodiments, taking the instant messaging client 410 as an enterprise instant messaging client as an example, when receiving a user's click operation on a web link (e.g., URL) displayed in the human-computer interaction interface of the instant messaging client 410, the web page corresponding to the web link can be displayed in a manner independent of the native interface of the instant messaging client 410, for example, the instant messaging client 410 can call a browser and display the web page corresponding to the web link in the browser. Then the instant messaging client 410 can inject code into the web page, and establish a communication channel between the instant messaging client 410 and the web page through the code. Then, when receiving a user's click operation on a translation control (e.g., a "Translate Full Text" button) displayed in suspension in the web page, the text to be translated in the web page can be extracted through the above code, and then the web page can send the text to be translated to the instant messaging client 410 through the established communication channel. After receiving the text to be translated sent by the web page, the instant messaging client 410 can send the text to be translated to the server 200 through the network 300, so that the server 200 translates the text to be translated. After receiving the translation result for the text to be translated returned by the server 200, the instant messaging client 410 can send the translation result to the web page through the established communication channel, so that the web page can be updated based on the translation result. In this way, the content of the web page opened in the instant messaging client can be conveniently translated, thereby effectively solving the language barrier problem encountered by users when reading web pages in the instant messaging client.

[0050] In other embodiments, the embodiments of the present application can also be implemented with the aid of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data calculation, storage, processing, and sharing.

[0051] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources.

[0052] For example, Figure 1The server 200 in the example may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDNs), and big data and artificial intelligence platforms. The terminal device 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, etc., but is not limited thereto. The terminal device 400 and the server 200 may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0053] In some embodiments, the terminal device or server can also implement the web page processing method of the instant messaging client provided in the embodiment of the present application by running various computer executable instructions or computer programs. For example, computer executable instructions can be commands, machine instructions or software instructions at the microprogram level. The computer program can be a native program or software module in the operating system; it can be a local (Native) application (APPlication, APP), that is, a program that needs to be installed in the operating system to run, such as an instant messaging APP; it can also be a small program that can be embedded in any APP, that is, a program that can be run only by downloading it to a browser environment. In short, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form.

[0054] The structure of the electronic device provided in the embodiment of the present application is further described below. Taking the electronic device as a terminal device as an example, see Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application, Figure 2 The electronic device 500 shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 2 Various buses are labeled as bus system 540 .

[0055] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0056] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0057] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 510.

[0058] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.

[0059] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0060] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0061] A network communication module 552, for reaching other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB);

[0062] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);

[0063] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.

[0064] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 The web page processing device 555 of the instant messaging client stored in the memory 550 is shown, which can be software in the form of a program or a plug-in, including the following software modules: a display module 5551, an injection module 5552, a receiving module 5553, a sending module 5554, an extraction module 5555 and an update module 5556. These modules are logical, and therefore can be arbitrarily combined or further split according to the functions implemented. It should be noted that in Figure 2 For the sake of convenience, all the above modules are shown at once, but it should not be regarded as excluding the implementation of the web page processing device 555 of the instant messaging client that can only include the display module 5551, the injection module 5552, the receiving module 5553 and the sending module 5554. The functions of each module will be explained below.

[0065] The web page processing method of the instant messaging client provided in the embodiment of the present application will be specifically described below in combination with the exemplary application and implementation of the terminal device provided in the embodiment of the present application.

[0066] In order to facilitate understanding of the web page processing method of the instant messaging client provided in the embodiment of the present application, the mutual calling process between the instant messaging client and the web page is first described.

[0067] For example, see Figure 3 , Figure 3 is a schematic diagram of mutual calls between an instant messaging client and a web page provided in an embodiment of the present application, such as Figure 3 As shown, in the terminal device, the operating system layer 320 runs on the hardware layer 310, and the application layer 330 shows the instant messaging client (i.e., the local application). The operating system can be Android. The web page loaded by the instant messaging client (such as the H5 page) can be embedded with a JS script. The instant messaging client can create an instance of the Webview component in its own content space as the running environment of the JS script. The JS interpreter in the Webview component interprets and executes the JS script to implement various functions in the web page, such as loading dynamic functions, responding to various user operations, etc.

[0068] In some embodiments, the functions implemented by the JS script may include: detecting instant messaging clients, automatically completing based on user input, displaying various function buttons, popping up a dialog box after clicking a button on a web page, checking whether the syntax of the data filled in by the user in the form is correct and prompting when there is an error, etc., which cannot be enumerated here.

[0069] The Webview component can also serve as an intermediary for communication between JS scripts and instant messaging clients. The communication between JS scripts and instant messaging clients is achieved through mutual calls between JS scripts and instant messaging clients, which are manifested as mutual calls between JS methods and local methods, as explained below.

[0070] 1) The instant messaging client calls the JS script

[0071] When the instant messaging client needs to call the JS script in the web page, first, the instant messaging client enables the Webview component to support JS. An example of enabling the Webview component to support JS is:

[0072] contentWebView.getSettings().setJavaScriptEnabled(true); true means setting JS support to be enabled.

[0073] Then, the instant messaging client can use the loading method (remembered as loadUrl) provided by the Webview component to call the name of the JS method and pass parameters. An example of calling the JS script and passing parameters is:

[0074] webView.loadUrl("javascript:methodName(parameterValues); methodName represents the name of the JS method called, and parameterValues ​​represents the parameters passed to the JS method.

[0075] If the called JS method has a return value, but the instant messaging client cannot obtain the return value through the loadUrl method, the instant messaging client defines a Java method for the JS method to call, and the JS method passes the return value to the JS script by calling the Java method.

[0076] For example, the instant messaging client can also call the web page through the URL Scheme. Among them, URL Schema is a page jump protocol. By defining your own Schema protocol, you can easily jump to each page in the application; through the Schema protocol, the server can customize the notification application to jump to which page, for example, you can customize the jump page through the notification bar message, or you can jump to the page through the H5 page. The URL Schema protocol format is explained below. Take the URL Schema of "xl: / / goods:8888 / goodsDetail?goodsId=10011002" as an example, where xl represents the name of the Schema protocol, goods represents which address domain the Schema acts on, goodsDetail represents the page specified by the Schema, goodsId represents the passed parameters, and 8888 represents the port number of the path. In this way, the local application can obtain the relevant parameters carried by the URL Scheme request by intercepting the URL Scheme request sent by the page.

[0077] 2) JS script calls the instant messaging client

[0078] When the JS script needs to call the instant messaging client, the JS script binds the interface provided by the Webview component for calling the instant messaging client, and then calls the method of the instant messaging client and passes parameters. An example is:

[0079] window.JSInterfaceName.methodName(parameterValues); wherein JSInterfaceName represents the interface for calling the instant messaging client, methodName(parameterValues) represents the name of the method of the instant messaging client to be called, and methodName(parameterValues) represents the parameters to be passed to the called instant messaging client.

[0080] The following will be combined Figure 4 The web page processing method of the instant messaging client provided in the embodiment of the present application is specifically described.

[0081] For example, see Figure 4 , Figure 4 is a flow chart of a web page processing method of an instant messaging client provided in an embodiment of the present application, which will be combined with Figure 4 The steps shown are explained.

[0082] It should be noted that, for the sake of convenience, no specific distinction is made between the terminal device and the instant messaging client running on the terminal device in the following text.

[0083] In step 101, in response to a triggering operation on a webpage link in an instant messaging client, a webpage corresponding to the webpage link is displayed.

[0084] In some embodiments, the instant messaging client may include a session interface (for example, a group chat session interface and a point-to-point private chat session interface), wherein the session interface may include a target instant messaging message carrying a web link (for example, a URL). Step 101 may be implemented in the following manner: in response to a trigger operation (for example, a click operation) on the web link carried by the target instant messaging message, displaying a web page corresponding to the web link in a manner independent of the native interface of the instant messaging client.

[0085] For example, taking the instant messaging client as an enterprise instant messaging client, a group chat list may be displayed in the human-computer interaction interface of the enterprise instant messaging client, wherein the group chat list may include multiple group chats, such as group chat A, group chat B, group chat C, and group chat D. When a click operation is received from the current user (e.g., user 1) on group chat B in the group chat list, a group chat session interface of group chat B may be displayed, and at least one instant messaging message including a target instant messaging message (e.g., instant messaging message 1 sent by user 2) carrying a web link (e.g., URL) may be displayed in the group chat session interface of group chat B. When a click operation is received from user 1 on a web link carried by instant messaging message 1 sent by user 2, a web page corresponding to the web link may be displayed in a manner independent of the native interface of the enterprise instant messaging client, for example, the enterprise instant messaging client may call a browser running on a terminal device to display a web page (e.g., an H5 page) corresponding to the web link through the browser; or, the enterprise instant messaging client may also call a WebView component to display a web page corresponding to the web link through the WebView component. That is to say, the user can also open the corresponding web page through the web page link carried in the instant messaging message.

[0086] In other embodiments, the instant messaging client may further include an email processing interface (e.g., an email receiving interface), wherein the email processing interface may include a target email carrying a web link, and the above-mentioned step 101 may be implemented in the following manner: in response to a trigger operation (e.g., a click operation) on the web link carried by the target email, displaying a web page corresponding to the web link in a manner independent of the native interface of the instant messaging client.

[0087] For example, taking the instant messaging client as an enterprise instant messaging client, an email processing entrance may be displayed in the human-computer interaction interface of the enterprise instant messaging client. When a click operation is received from the current user (e.g., user 1) on the email processing entrance, an email processing interface may be displayed, wherein the email processing interface may include at least one email received by user 1 including a target email carrying a web link (e.g., email 1 sent by user 2). When a click operation is received from user 1 on a web link (e.g., URL) carried in email 1 sent by user 2, a web page corresponding to the web link may be displayed in a manner independent of the native interface of the enterprise instant messaging client. For example, the enterprise instant messaging client may call a browser running on a terminal device to display a web page corresponding to the web link through the browser; or, the enterprise instant messaging client may also call a WebView component to display a web page corresponding to the web link through the WebView component. That is, the user may open the corresponding web page through the web link carried in the email.

[0088] In some embodiments, the instant messaging client may further include a workbench interface, wherein the workbench interface may include a target application (e.g., a customer service application) carrying a web link. Step 101 may be implemented in the following manner: in response to a trigger operation on the web link carried by the target application, displaying a web page corresponding to the web link in a manner independent of the native interface of the instant messaging client.

[0089] For example, taking the instant messaging client as an enterprise instant messaging client, a workbench entrance can be displayed in the human-computer interaction interface of the enterprise instant messaging client. When a click operation is received from the current user (e.g., user 1) on the workbench entrance, the workbench interface can be displayed, wherein the workbench interface can include at least one application including a target application carrying a web link. When a click operation is received from user 1 on a web link carried by the target application, a web page corresponding to the web link can be displayed in a manner independent of the native interface of the enterprise instant messaging client. For example, the enterprise instant messaging client can call a browser running on a terminal device to display a web page corresponding to the web link through the browser; or, the enterprise instant messaging client can also call a WebView component to display a web page corresponding to the web link through the WebView component. In other words, users can also open corresponding web pages through web links carried in the workbench application.

[0090] In step 102, code is injected into the webpage, and a communication channel between the instant messaging client and the webpage is established through the code.

[0091] In some embodiments, since the web page is displayed in a manner independent of the native interface of the instant messaging client, code needs to be injected into the web page to establish a communication channel between the instant messaging client and the web page through the code, thereby achieving two-way communication between the instant messaging client and the web page.

[0092] For example, the type of code may include one of the following: message handlers, global functions, and bridges (JSBridge). The above-mentioned code injection into the web page may be implemented in the following manner: when the operating system running the instant messaging client is a first type of operating system (such as iOS and Mac operating systems), the message handler may be registered with the browser engine (such as Webkit) of the browser used to display the web page, so as to establish a communication channel between the instant messaging client and the web page through the message handler; when the operating system running the instant messaging client is a second type of operating system (such as Windows operating system), the global function may be registered with the browser engine (such as V8 engine in Cef) of the browser used to display the web page, so as to establish a communication channel between the instant messaging client and the web page through the global function; when the operating system running the instant messaging client is a third type of operating system (such as Android operating system), the bridge may be injected into the browser used to display the web page, so as to establish a communication channel between the instant messaging client and the web page through the bridge.

[0093] For example, taking the instant messaging client as an enterprise instant messaging client, when the operating system running the enterprise instant messaging client is the iOS operating system or the Mac operating system, the two-way communication between the JS script embedded in the web page and the enterprise instant messaging client can be completed by registering MessageHandlers to the browser engine (such as Webkit) of the browser used to display the web page.

[0094] For example, taking the instant messaging client as an enterprise instant messaging client, when the operating system running the enterprise instant messaging client is a Windows operating system, a global function can be registered with the browser engine of the browser used to display the web page. For example, after registering the global function with the V8 engine in Cef, two-way communication between the JS script embedded in the web page and the enterprise instant messaging client can be completed.

[0095] For example, taking the instant messaging client as an enterprise instant messaging client, when the operating system running the enterprise instant messaging client is the Android operating system, JSBridge can be injected into the browser used to display the web page to complete the two-way communication between the JS script embedded in the web page and the enterprise instant messaging client.

[0096] In other embodiments, after the instant messaging client injects code (e.g., wwtranslate.js code) into the webpage, the webpage may execute the js code injected by the instant messaging client to establish a two-way communication channel between the JS script and the instant messaging client (i.e., the local application), and then the webpage may return a notification to the instant messaging client that the webpage is ready to complete the two-way communication between the JS script and the instant messaging client, for example, the webpage may send an OnContentReady notification to the instant messaging client. In addition, after receiving the OnContentReady notification sent by the webpage, the instant messaging client may also send a registration change notification (setPersistSeed) to the webpage to inform the webpage that it is aware that the communication channel has been established.

[0097] In step 103, a text to be translated sent by a web page through a communication channel is received.

[0098] In some embodiments, the web page may include a translation control (e.g., a "Translate Full Text" button). Figure 5A , Figure 5A is a flow chart of a web page processing method of an instant messaging client provided in an embodiment of the present application, such as Figure 5A As shown, in the execution Figure 4 Before step 103 shown, you can also perform Figure 5A Step 107A shown combines Figure 5A The steps shown are explained.

[0099] In step 107A, in response to a trigger operation on a translation control, the text to be translated included in the webpage is extracted through code.

[0100] In some embodiments, the above-mentioned extraction of the text to be translated included in the web page through code can be achieved in the following manner: obtaining the document object model tree (i.e., DOM tree) of the web page; obtaining the nodes including text tags in the document object model tree as valid nodes; creating a mapping relationship between the identifier of the valid node and the text content corresponding to the text tag; encoding the text content corresponding to the valid node to obtain the text to be translated that conforms to the set format (e.g., JSON format).

[0101] In other embodiments, the acquisition of the document object model tree of the web page can be achieved in the following manner: acquiring the hypertext markup language source code (ie, HTML source code) of the web page; parsing the hypertext markup language source code to obtain the document object model tree of the web page.

[0102] For example, a "Translate Full Text" button can be suspended and displayed in a web page. When a user clicks on the "Translate Full Text" button, the text to be translated in the web page can be extracted by the code injected in step 102. The specific implementation process is as follows: the HTML source code of the web page can be first obtained, and then the HTML source code of the web page is parsed to obtain the DOM tree of the web page, and the DOM tree is traversed, and the valid nodes (i.e., nodes including text tags) in the DOM tree are recursively found, and redundant nodes without display and non-text content are filtered. That is to say, the embodiment of the present application only translates the text content in the web page, and then the hash (Hash) mapping relationship between the identifier (such as ID) of the valid node and the text content (TextContent) corresponding to the text tag can be recorded, and the recording state is the original state. Finally, the text content corresponding to the valid node can be encoded, and the text to be translated in JOSN format can be obtained and sent to the instant messaging client. That is to say, the translation of the web page content can be manually triggered by the user, and the text content in the web page is translated after receiving the user's click operation on the translation control displayed in the web page.

[0103] It should be noted that the user can also select the target language type to be translated by himself. For example, when a user long presses a translation control (such as a "Translate Full Text" button), multiple candidate language types (such as Chinese, Japanese, Korean, French, etc.) can be displayed for the user to select. For example, if the user's native language is Chinese, the text to be translated in the webpage can be translated into Chinese by default. Of course, the user can also select the target language type to be translated by himself. For example, if the user selects Japanese from multiple candidate language types, the text to be translated in the webpage can be translated into Japanese, thereby meeting the personalized needs of the user.

[0104] In other embodiments, see Figure 5B , Figure 5B is a flow chart of a web page processing method of an instant messaging client provided in an embodiment of the present application, such as Figure 5B As shown, in the execution Figure 4 Before step 103 shown, you can also perform Figure 5B Step 107B shown combines Figure 5B The steps shown are explained.

[0105] In step 107B, in response to the language type of the webpage being different from the language type of the instant messaging client, the text to be translated included in the webpage is extracted through code.

[0106] In some embodiments, the text content in the webpage can also be automatically translated. For example, when it is detected that the language type of the webpage is different from the language type of the instant messaging client, the text to be translated in the webpage can be automatically extracted through the code injected in step 102. For example, taking the instant messaging client as an enterprise instant messaging client as an example, assuming that the language type of the enterprise instant messaging client is Chinese, and the language type of the webpage opened in the enterprise instant messaging client is English (that is, the user opens an English webpage), the text to be translated in the webpage can be automatically extracted through the code injected in step 102, that is, when it is detected that the language type of the webpage is different from the language type of the enterprise instant messaging client, the text content in the webpage can be automatically translated to solve the language barrier problem encountered by the user when reading an English webpage.

[0107] In some embodiments, see Figure 5C , Figure 5C is a flow chart of a web page processing method of an instant messaging client provided in an embodiment of the present application, such as Figure 5C As shown, in the execution Figure 4 Before step 103 shown, you can also perform Figure 5C Step 107C shown combines Figure 5C The steps shown are explained.

[0108] In step 107C, in response to the language type of the webpage being different from the language type of the operating system running the instant messaging client, the text to be translated included in the webpage is extracted through code.

[0109] In some embodiments, the text content in the webpage can also be automatically translated. For example, when it is detected that the language type of the webpage is different from the language type of the operating system running the instant messaging client, the text to be translated in the webpage can be automatically extracted through the code injected in step 102. For example, taking the instant messaging client as an enterprise instant messaging client as an example, assuming that the language type of the operating system running the enterprise instant messaging client is Chinese, and the language type of the webpage opened in the enterprise instant messaging client is English, that is, the user opens an English webpage in the enterprise instant messaging client, then the text to be translated in the English webpage (that is, the English text content to be translated) can be automatically extracted through the code injected in step 102, that is, when it is detected that the language type of the operating system running the enterprise instant messaging client is different from the language type of the webpage, the text content in the webpage can be automatically translated to solve the language barrier problem encountered by the user when reading the webpage in the enterprise instant messaging client.

[0110] In step 104, the text to be translated is sent to the server.

[0111] In some embodiments, step 104 can be implemented in the following manner: sending a translation request carrying the text to be translated to the server, wherein the translation request is used for the server to perform the following processing: extracting the text to be translated from the translation request, and translating the language type of the text to be translated from a first language type to a second language type, wherein the first language type is the original language type of the text to be translated (e.g., English), and the second language type may include one of the following: a selected language type, a language type of the instant messaging client (e.g., Chinese), and a language type of an operating system running the instant messaging client.

[0112] For example, taking the instant messaging client as an enterprise instant messaging client, after receiving the text to be translated sent by the web page through the communication channel, the enterprise instant messaging client can encapsulate the text to be translated into a translation request, and then send the translation request to the server (e.g., a server dedicated to providing translation services), wherein the translation request carries the text to be translated sent by the web page. After receiving the translation request sent by the enterprise instant messaging client, the server can first extract the text to be translated from the translation request, and then translate the language type of the text to be translated from the first language type (e.g., English) into the second language type (e.g., Chinese).

[0113] It should be noted that the translation request may also carry the target language type set by the user (i.e., the language type selected by the user). When the server extracts the text to be translated from the translation request, it may also extract the target language type set by the user from the translation request, and then the server may translate the text to be translated into the target language type. When the translation request does not carry the target language type set by the user, the server may translate the text to be translated into the target language type set by the user last time, or translate the text to be translated into the same language type as the language type of the instant messaging client, and the embodiments of the present application do not specifically limit this.

[0114] In step 105, a translation result for the text to be translated returned by the server is received.

[0115] In some embodiments, taking the instant messaging client as an enterprise instant messaging client as an example, after the server translates the text to be translated sent by the enterprise instant messaging client and obtains the translation result for the text to be translated, the server can return the translation result to the enterprise instant messaging client.

[0116] In step 106, the translation result is sent to the webpage through the communication channel, so that the webpage is updated based on the translation result.

[0117] In some embodiments, the above-mentioned update based on the translation result on the web page can be achieved in the following manner: decode the translation result to obtain a translated text in the same format as the text content (i.e., the text content before translation in the web page); determine, according to the mapping relationship established when extracting the text to be translated, the valid nodes corresponding to the translated text from the document object model tree; and replace the text content corresponding to the valid nodes (such as "Hello") with the translated text (such as "你好").

[0118] Exemplarily, taking the enterprise instant messaging client as an example of the instant messaging client, after the enterprise instant messaging client receives the translation result returned by the server, it can return the translation result to the web page through the previously established communication channel. After the web page receives the translation result sent by the enterprise instant messaging client, it can first decode the translation result to obtain a translated text in the same format as the original text content in the web page. Then, it can find the valid nodes corresponding to the translated text from the DOM tree of the web page according to the mapping relationship established when extracting the text to be translated. Finally, it can replace the original text content corresponding to the valid nodes with the translated text, so as to achieve the translation of the text content in the web page.

[0119] For the web page processing method of the instant messaging client provided in the embodiments of the present application, when a user needs to read a web page in the instant messaging client, the user can first inject code into the web page to establish a communication channel between the instant messaging client and the web page through the code. Then, after the instant messaging client receives the text to be translated sent by the web page through the communication channel, it can send the received text to be translated to the server so that the server can translate the text to be translated. Subsequently, when the instant messaging client receives the translation result returned by the server, it can return the translation result to the web page through the communication channel to update the web page based on the translation result. In this way, it is possible to conveniently translate the web page content opened in the instant messaging client, thereby solving the language barrier problem encountered by the user when reading the web page in the instant messaging client.

[0120] Next, taking the enterprise instant messaging client as an example, an exemplary application of the embodiments of the present application in an actual application scenario will be described.

[0121] The embodiment of the present application is aimed at enterprise instant messaging clients, and expands the original IM message translation capabilities of enterprise instant messaging clients to all web page scenarios, such as web pages opened from IM messages, and H5 web pages opened from enterprise emails and workbench applications. Enterprise instant messaging clients can analyze the web page structure in various scenarios and extract the corresponding text content respectively. For example, taking iOS and Mac platforms as examples, they can provide a quick translation entrance through automatic recognition capabilities on iOS and Mac platforms, and can recognize changes in web page structure in real time, so as to refresh the translation results of the changed content without perception, realizing the convenient translation of multilingual web page content encountered by users in enterprise instant messaging clients, and solving the language barrier problem encountered by users when reading web pages.

[0122] That is to say, the technical solution provided by the embodiment of the present application can solve the language barrier problem encountered by users in multiple scenarios when entering web pages (including IM messages / applications / emails) in enterprise instant messaging clients, and users can trigger translation and quickly compare the original text and translation when reading web pages. In addition, the embodiment of the present application can also expand the translation capability to any web page, extract the text content in the web page, and identify web page changes in real time.

[0123] The web page processing method of the instant messaging client provided in the embodiment of the present application is described in detail below.

[0124] In some embodiments, taking iOS devices as an example, see Fig. 6A , Fig. 6A Schematic diagram of an application scenario of the web page processing method of the instant messaging client provided in the embodiment of the present application. Fig. 6A As shown, the iOS device can display a "Translate Full Text" button 601 (corresponding to the above-mentioned translation control) in a floating state in the web page 600. When receiving a click operation from the user on the "Translate Full Text" button 601 displayed in the floating state in the web page 600, the text content in the web page 600 can be translated, and the "Translate Full Text" button 601 can be switched to the "translating" state 602.

[0125] In some other embodiments, taking a Mac device as an example, see Figure 6B , Figure 6B Schematic diagram of an application scenario of the web page processing method of the instant messaging client provided in the embodiment of the present application. Figure 6BAs shown, a translation option (e.g., a "Translate Full Text" button) may be displayed in the middle of the navigation bar of the Mac device. When a user clicks the "Translate Full Text" button, the text content in the webpage may be translated, and the "Translate Full Text" button may be switched to a "Translating" state 603. When the translation of the text content in the webpage is completed, the "Translate Full Text" button may be switched to a "Show Original Text" button 604. When a user clicks the "Show Original Text" button 604, the text content in the webpage may be switched back to the original text, for example, from Chinese back to English.

[0126] In some embodiments, see Figure 7 , Figure 7 Schematic diagram of the principle of the web page processing method of the instant messaging client provided in the embodiment of the present application. Figure 7 As shown, each platform (for example, including iOS, Mac, Android, Windows) can uniformly inject a section of js code (for example, wwtranslate.js code) when opening a webpage in a browser, and realize the communication between the webpage and the terminal device (i.e., the enterprise instant messaging client running on the terminal device) and the ability to automatically extract the text to be translated through the js code. After the terminal device receives the text to be translated sent by the webpage based on this communication channel, the text to be translated can be submitted to the translation service (for example, the background translation service of the enterprise instant messaging client) so that the translation service translates the text to be translated and obtains the translation result. Subsequently, after receiving the translation result returned by the translation service, the terminal device can return the translation result to the webpage through the above-mentioned communication channel, and the JS script embedded in the webpage can re-render the webpage based on the translation result, that is, display the translated text content in the webpage.

[0127] Next, continue to combine Figure 8 The web page processing method of the instant messaging client provided in the embodiment of the present application is specifically described.

[0128] For example, see Figure 8 , Figure 8 is a flow chart of a web page processing method of an instant messaging client provided in an embodiment of the present application, which will be combined with Figure 8 The steps shown are explained.

[0129] In step 201, the client injects the wwtranslate.js code into the web page.

[0130] In some embodiments, the client (i.e., the enterprise instant messaging client) injects the wwtranslate.js code before the web page starts to establish a communication channel between the enterprise instant messaging client and the web page. For example, iOS and Mac devices can complete the communication from the JS script to the terminal device by registering MessageHandlers with Webkit, Windows devices can complete the communication from the JS script to the terminal device by registering the global function with the V8 engine in Cef, and Android devices can directly use JSBridge to complete the two-way communication between the JS script and the terminal device.

[0131] In step 202, the web page executes the js code.

[0132] In step 203, the webpage sends an OnContentReady notification to the client.

[0133] In step 204, the client sends a registration change notification to the webpage.

[0134] In some embodiments, the webpage translation process protocol may include:

[0135] 1) Notify the web page to complete the JS script to the native application (Native): OnContentReady protocol;

[0136] 2) Registration change notification: setPersistSeed protocol;

[0137] 3) Get the full amount of text to be translated from Native to JS script: getPlainText protocol;

[0138] 4) The terminal device calls back the translation result to the interface Native to JS script: replaceText protocol;

[0139] 5) Through network request, trigger the translation service of the enterprise instant messaging client to return the translated text Native to the translation service (Server): translate protocol.

[0140] In step 205, the webpage sends the text to be translated to the client.

[0141] In some embodiments, the text to be translated in a web page can be extracted in the following manner: first, recursively search for valid nodes (i.e., nodes including text tags) from the DOM tree of the web page, filter out redundant nodes that are not displayed and have non-text content, then record the hash mapping relationship between the ID of the valid node (Node) and the text content (textContent), record the state as the original state, then wait for the getPlainText protocol, re-encode the text content corresponding to the valid node into the text to be translated, and call back to the terminal device.

[0142] In step 206, the client sends a translation request to the translation service.

[0143] In step 207, the translation service sends the translation result to the client.

[0144] In step 208, the client sends the translation result to the web page.

[0145] In step 209, the webpage is updated based on the translation result.

[0146] In some embodiments, after the translation service has translated the text to be translated sent by the enterprise instant messaging client, the translation result can be returned to the enterprise instant messaging client through the replaceText protocol. After receiving the translation result returned by the translation service, the enterprise instant messaging client can return the translation result to the web page through the communication channel. After the web page decodes the translation result, it finds the corresponding node to be translated (i.e., the above-mentioned valid node) through the mapping relationship and refreshes the upper screen. In addition, an interface identifier can also be registered. When a change in an interface node is identified, the translation can be updated for this node, and a change notification can be triggered during the translation.

[0147] In step 210, the webpage sends a change notification to the client.

[0148] In step 211 , the client sends a new translation request to the translation service.

[0149] In step 212, the translation service sends the new translation result to the client.

[0150] In step 213, the client sends the new translation result to the web page.

[0151] In step 214, the web page is updated based on the new translation result.

[0152] In some embodiments, the embodiments of the present application can obtain the target language type (e.g., Chinese) set by the user in the terminal device settings, and record it in the browser opening / email scenes. After the webpage / email scenes are opened for automatic or manual translation, the user can also temporarily select other types of languages ​​for re-translation. For example, when the user temporarily selects other types of languages ​​(e.g., Japanese), the webpage can send a change notification to the enterprise instant messaging client, and the enterprise instant messaging client will record the other language types temporarily selected by the user as the target translation language type of the current scene. When jumping to a web page or jumping to an email in this scene, the target translation language type temporarily selected by the user will be given priority, that is, the text content in the webpage will be translated into Japanese first.

[0153] In summary, the technical solution provided by the embodiments of the present application has the following beneficial effects:

[0154] Through the technical solution provided in the embodiments of the present application, users can obtain the ability to translate when entering web pages and mailboxes in various scenarios in the enterprise instant messaging client, and can use content recognition to update the translated content in real time when changes are detected in the web page content. It provides the ability to customize the target language type in the translation scenario, realizes the free switching of the target language type, and automatically records the translation language type within the scenario, solving the language barrier problem when users read web pages and emails in multiple scenarios.

[0155] The following is a description of an exemplary structure of the web page processing device 555 of the instant messaging client provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 2 As shown, the software modules stored in the web page processing device 555 of the instant messaging client in the memory 550 may include: a display module 5551 , an injection module 5552 , a receiving module 5553 and a sending module 5554 .

[0156] Display module 5551 is used to display the web page corresponding to the web link in response to the trigger operation on the web link in the instant messaging client; injection module 5552 is used to inject code into the web page, and establish a communication channel between the instant messaging client and the web page through the code; receiving module 5553 is used to receive the text to be translated sent by the web page through the communication channel; sending module 5554 is used to send the text to be translated to the server; receiving module 5553 is also used to receive the translation result of the text to be translated returned by the server; sending module 5554 is also used to send the translation result to the web page through the communication channel, so that the web page is updated based on the translation result.

[0157] In some embodiments, the instant messaging client includes a session interface, which includes a target instant messaging message carrying a web link; the display module 5551 is also used to respond to a trigger operation on the web link carried by the target instant messaging message, and display the web page corresponding to the web link in a manner independent of the native interface of the instant messaging client.

[0158] In some embodiments, the instant messaging client includes an email processing interface, which includes a target email carrying a web link; the display module 5551 is also used to respond to a trigger operation on the web link carried by the target email, and display the web page corresponding to the web link in a manner independent of the native interface of the instant messaging client.

[0159] In some embodiments, the instant messaging client includes a workbench interface, which includes a target application carrying a web link; the display module 5551 is also used to respond to a trigger operation on the web link carried by the target application, and display the web page corresponding to the web link in a manner independent of the native interface of the instant messaging client.

[0160] In some embodiments, the web page includes a translation control; the web page processing device 555 of the instant messaging client also includes an extraction module 5555, which is used to extract the text to be translated included in the web page through code in response to a trigger operation on the translation control before the receiving module 5553 receives the text to be translated sent by the web page through the communication channel.

[0161] In some embodiments, the extraction module 5555 is further used to extract the text to be translated included in the web page through code in response to the language type of the web page being different from the language type of the instant messaging client before the receiving module 5553 receives the text to be translated sent by the web page through the communication channel.

[0162] In some embodiments, the extraction module 5555 is further used to extract the text to be translated included in the web page through code in response to the language type of the web page being different from the language type of the operating system running the instant messaging client before the receiving module 5553 receives the text to be translated sent by the web page through the communication channel.

[0163] In some embodiments, the extraction module 5555 is also used to perform the following processing through code: obtain the document object model tree of the web page; obtain the nodes including text tags in the document object model tree as valid nodes; create a mapping relationship between the identifier of the valid node and the text content corresponding to the text tag; encode the text content corresponding to the valid node to obtain the text to be translated that conforms to the set format.

[0164] In some embodiments, the web page processing device 555 of the instant messaging client also includes an update module 5556, which is used to decode the translation result to obtain a translated text in the same format as the text content; according to the mapping relationship, determine the valid node corresponding to the translated text from the document object model tree; and replace the text content corresponding to the valid node with the translated text.

[0165] In some embodiments, the extraction module 5555 is further used to obtain the hypertext markup language source code of the web page; parse the hypertext markup language source code to obtain the document object model tree of the web page.

[0166] In some embodiments, the sending module 5554 is also used to send a translation request carrying the text to be translated to the server, wherein the translation request is used for the server to perform the following processing: extracting the text to be translated from the translation request, and translating the language type of the text to be translated from the first language type to the second language type, the first language type is the original language type of the text to be translated, and the second language type includes one of the following: the selected language type, the language type of the instant messaging client, and the language type of the operating system running the instant messaging client.

[0167] In some embodiments, the types of codes include: message handlers, global functions, and bridges; the injection module 5552 is also used to perform the following processing: when the operating system running the instant messaging client is a first type of operating system, registering the message handler with the browser engine of the browser used to display the web page; when the operating system running the instant messaging client is a second type of operating system, registering the global function with the browser engine of the browser used to display the web page; when the operating system running the instant messaging client is a third type of operating system, injecting the bridge into the browser used to display the web page.

[0168] It should be noted that the description of the device in the embodiment of the present application is similar to the description of the method embodiment above, and has similar beneficial effects as the method embodiment, so it will not be repeated. Figure 4 ,or FIG. 5A to FIG. 5C The present invention should be understood by referring to the description of any one of the accompanying drawings.

[0169] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer readable storage medium. The processor of the computer device reads the computer executable instruction from the computer readable storage medium, and the processor executes the computer executable instruction, so that the computer device executes the webpage processing method of the instant messaging client described in the embodiment of the present application.

[0170] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will be caused to execute the webpage processing method of the instant messaging client provided in the embodiment of the present application, for example, Figure 4 ,or FIG. 5A to FIG. 5C Any one of the accompanying drawings shows a web page processing method for an instant messaging client.

[0171] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.

[0172] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0173] As an example, the executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0174] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A web page processing method for an instant messaging client, characterized in that: The method comprises: In response to a triggering operation on a webpage link in the instant messaging client, displaying a webpage corresponding to the webpage link; Injecting code into the webpage, and establishing a communication channel between the instant messaging client and the webpage through the code; receiving a text to be translated sent by the webpage through the communication channel; Sending the text to be translated to a server; Receiving a translation result for the text to be translated returned by the server; The translation result is sent to the webpage through the communication channel, so that the webpage is updated based on the translation result.

2. The method according to claim 1, characterized in that The instant messaging client includes a conversation interface, and the conversation interface includes a target instant messaging message carrying a web page link; The step of displaying a web page corresponding to the web page link in response to a triggering operation on the web page link in the instant messaging client comprises: In response to a triggering operation on the webpage link carried by the target instant messaging message, a webpage corresponding to the webpage link is displayed in a manner independent of a native interface of the instant messaging client.

3. The method according to claim 1, characterized in that The instant messaging client includes an email processing interface, and the email processing interface includes a target email carrying a web page link; The step of displaying a web page corresponding to the web page link in response to a triggering operation on the web page link in the instant messaging client comprises: In response to a triggering operation on the webpage link carried in the target email, a webpage corresponding to the webpage link is displayed in a manner independent of a native interface of the instant messaging client.

4. The method according to claim 1, characterized in that: The instant messaging client includes a workbench interface, and the workbench interface includes a target application carrying a web page link; The step of displaying a web page corresponding to the web page link in response to a triggering operation on the web page link in the instant messaging client comprises: In response to a triggering operation on the webpage link carried by the target application, a webpage corresponding to the webpage link is displayed in a manner independent of a native interface of the instant messaging client.

5. The method according to claim 1, characterized in that The webpage includes a translation control; Before receiving the text to be translated sent by the webpage through the communication channel, the method further includes: In response to a triggering operation on the translation control, the text to be translated included in the webpage is extracted through the code.

6. The method according to claim 1, characterized in that Before receiving the text to be translated sent by the webpage through the communication channel, the method further includes: In response to the language type of the webpage being different from the language type of the instant messaging client, the text to be translated included in the webpage is extracted through the code.

7. The method according to claim 1, characterized in that Before receiving the text to be translated sent by the webpage through the communication channel, the method further includes: In response to the language type of the webpage being different from the language type of the operating system running the instant messaging client, the text to be translated included in the webpage is extracted through the code.

8. The method according to any one of claims 5 to 7, characterized in that: The extracting the text to be translated included in the webpage through the code comprises: The following processing is performed by the code: Obtaining a document object model tree of the web page; Obtaining a node including a text tag in the document object model tree as a valid node; Creating a mapping relationship between the identifier of the valid node and the text content corresponding to the text tag; The text content corresponding to the valid node is encoded to obtain a text to be translated that complies with a set format.

9. The method according to claim 8, characterized in that The updating of the webpage based on the translation result includes: Decoding the translation result to obtain a translation text in the same format as the text content; According to the mapping relationship, determining the valid node corresponding to the translated text from the document object model tree; The text content corresponding to the valid node is replaced with the translated text.

10. The method according to claim 8, characterized in that The step of obtaining the document object model tree of the webpage includes: Obtaining the hypertext markup language source code of the webpage; The hypertext markup language source code is parsed to obtain a document object model tree of the web page.

11. The method according to any one of claims 1 to 10, characterized in that: The sending the text to be translated to the server comprises: A translation request carrying the text to be translated is sent to a server, wherein the translation request is used for the server to perform the following processing: extracting the text to be translated from the translation request, and translating the language type of the text to be translated from a first language type to a second language type, wherein the first language type is the original language type of the text to be translated, and the second language type includes one of the following: a selected language type, a language type of the instant messaging client, and a language type of an operating system running the instant messaging client.

12. The method according to any one of claims 1 to 10, characterized in that: The types of the code include: message handler, global function, bridge; The injecting code into the webpage includes: When the operating system running the instant messaging client is a first type operating system, registering the message processing program with a browser engine of a browser used to display the web page; When the operating system running the instant messaging client is a second type operating system, registering the global function with a browser engine of a browser used to display the web page; When the operating system running the instant messaging client is a third-category operating system, the bridge is injected into a browser used to display the web page.

13. A web page processing device for an instant messaging client, characterized in that: The device comprises: A display module, configured to display a web page corresponding to the web page link in response to a triggering operation on the web page link in the instant messaging client; An injection module, used to inject code into the webpage, and establish a communication channel between the instant messaging client and the webpage through the code; A receiving module, used for receiving the text to be translated sent by the webpage through the communication channel; A sending module, used for sending the text to be translated to a server; The receiving module is further used to receive the translation result returned by the server for the text to be translated; The sending module is further used to send the translation result to the webpage through the communication channel, so that the webpage is updated based on the translation result.

14. An electronic device, characterized in that: include: A memory for storing executable instructions; The processor is used to implement the web page processing method of the instant messaging client according to any one of claims 1 to 12 when executing the executable instructions stored in the memory.

15. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by a processor, the web page processing method of the instant messaging client according to any one of claims 1 to 12 is implemented.

16. A computer program product comprising a computer program or computer executable instructions, characterized in that When the computer program or computer executable instruction is executed by a processor, the web page processing method of an instant messaging client according to any one of claims 1 to 12 is implemented.