Search

CN-121984956-A - Table synchronization method, device, equipment and medium of remote browser for DOM reconstruction

CN121984956ACN 121984956 ACN121984956 ACN 121984956ACN-121984956-A

Abstract

The invention provides a method, a device, equipment and a medium for synchronizing a Table of a remote browser reconstructed from a DOM (document object model), which comprise the steps of receiving incremental data containing a target HTML (hypertext markup language) fragment, carrying out tag identification on an HTML character string, extracting a starting tag name of the HTML character string, judging whether the HTML character string is a sub-tag with a Table structure according to the tag name, if the HTML character string belongs to the sub-tag with the preset Table structure, packaging the HTML character string into a corresponding legal container tag to form a complete HTML document fragment which can be analyzed, analyzing the packaged HTML document fragment by a document object model analyzer to generate a temporary document object, extracting a target node corresponding to the original HTML character string from the temporary document object, and inserting the extracted target node into a preset position in a parent node designated by a selector to finish incremental updating, so that the synchronization of the Table can be perfectly realized.

Inventors

  • LIU ZHIHAI
  • WANG WENSHENG
  • SU FUQING

Assignees

  • 福建紫讯信息科技有限公司

Dates

Publication Date
20260505
Application Date
20251204

Claims (10)

  1. 1. A Table synchronization method of a remote browser for DOM reconstruction is characterized by comprising the following steps: Step 1, receiving incremental data containing a target HTML fragment, wherein the incremental data at least comprises an HTML character string representing a node to be inserted and a selector of a designated father node; Step 2, carrying out tag identification on the HTML character string, and extracting the initial tag name of the HTML character string; Step 3, judging whether the label is a sub-label with a table structure according to the label name, and if the label belongs to the sub-label with the preset table structure, packaging the HTML character string into a corresponding legal container label to form a complete HTML document fragment which can be analyzed; Step 4, analyzing the encapsulated HTML document fragments by using a document object model analyzer to generate temporary document objects; step 5, extracting a target node corresponding to the original HTML character string from the temporary document object; And 6, inserting the extracted target node into a preset position in a father node designated by the selector, and finishing incremental updating.
  2. 2. The method of claim 1, wherein the incremental data further comprises insertion position information, and the target node is inserted into the child node sequence of the parent node according to the insertion position information.
  3. 3. The method of claim 1, wherein the pre-set sub-tags of the form structure comprise one or more of < tr >, < td >, < th > or < tbody >; The package is specifically: When the tag name is < tr >, wrapping the HTML string between < table > < tbody > and </tbody > </table >; When the tag name is < td > or < th >, wrapping the HTML string between < table > < tbody > < tr > and </tr > </tbody > </table >; when the tag name is < tbody >, wrapping the HTML string between < table > and </table >.
  4. 4. The method for synchronizing the tables of the remote browser for reconstructing the DOM of claim 1, wherein the tag identification matches a tag name at the beginning of an HTML string by using a regular expression, ignores case and skips over a leading blank character; The document object model parser is a standard DOMParser interface instance based on a browser environment, and the parsed media type is text/html; The step 5 specifically comprises the following steps: And according to the identified tag name, performing query operation in the temporary document object, and acquiring a first element node matched with the tag name as a target node.
  5. 5. The Table synchronization device of the remote browser for reconstructing the DOM is characterized by comprising the following components: the incremental data receiving module is used for receiving incremental data containing a target HTML fragment, wherein the incremental data at least comprises an HTML character string representing a node to be inserted and a selector for designating a father node; The identification and extraction module is used for carrying out label identification on the HTML character string and extracting the initial label name of the HTML character string; the HTML packaging module judges whether the label is a sub-label with a table structure according to the label name, if the label belongs to the sub-label with the preset table structure, the HTML character string is packaged in the corresponding legal container label to form a complete HTML document fragment which can be analyzed; The analysis generating module is used for analyzing the packaged HTML document fragments by using a document object model analyzer to generate temporary document objects; the extracting node module is used for extracting a target node corresponding to the original HTML character string from the temporary document object; And the node inserting module is used for inserting the extracted target node into a preset position in a father node designated by the selector to finish incremental updating.
  6. 6. The device for Table synchronization of a remote browser for DOM reconstruction as recited in claim 5, wherein the incremental data further comprises insertion location information, and wherein the target node is inserted into the sequence of child nodes of the parent node according to the insertion location information.
  7. 7. The device of claim 5, wherein the pre-set sub-tags of the form structure comprise one or more of < tr >, < td >, < th > or < tbody >; The package is specifically: When the tag name is < tr >, wrapping the HTML string between < table > < tbody > and </tbody > </table >; When the tag name is < td > or < th >, wrapping the HTML string between < table > < tbody > < tr > and </tr > </tbody > </table >; when the tag name is < tbody >, wrapping the HTML string between < table > and </table >.
  8. 8. The device for synchronizing the tables of a remote browser for DOM reconstruction of claim 5, wherein said tag identification matches a tag name at the beginning of an HTML string with a regular expression, ignores case and skips over a leading blank character; The document object model parser is a standard DOMParser interface instance based on a browser environment, and the parsed media type is text/html; The extraction node module specifically comprises: And according to the identified tag name, performing query operation in the temporary document object, and acquiring a first element node matched with the tag name as a target node.
  9. 9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 4 when the program is executed by the processor.
  10. 10. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any one of claims 1 to 4.

Description

Table synchronization method, device, equipment and medium of remote browser for DOM reconstruction Technical Field The invention relates to the technical field of remote browsers, in particular to a method, a device, equipment and a medium for synchronizing tables of a remote browser for DOM reconstruction. Background Modern browsers face a variety of security threats, including malicious websites, malicious scripts, and the like. These threats may lead to user data leakage, device infection, or system damage. Conventional browsers use sandboxed technology to isolate web pages from interaction with operating systems and other applications. However, many modern web sites and applications contain complex JavaScript code, advertisements, plug-ins, etc., which may present additional security risks. To address these security issues, remote browser technology has evolved. The remote browser isolates the user's network activity from the local device by running browser instances on the remote server. The browser operation and data processing of the user are carried out at the cloud end, and the local computer only receives the processed content. This quarantine can effectively prevent direct threat of malicious code to the local system. When the existing remote browser realized by the DOM mode processes the content of the Table tag, the processing mode is the same as the DOM synchronization of html, but the Table is a special tag, the sub-tag such as tr, td, th, tbody can be effective only under the Table domain, and if only the independent sub-tag can lose the effect, the effect can be treated as invalid. Disclosure of Invention The invention aims to solve the technical problem of providing a method, a device, equipment and a medium for synchronizing the Table of a remote browser reconstructed from DOM, which can perfectly realize the synchronization of the Table. In a first aspect, the present invention provides a Table synchronization method for a remote browser for DOM reconstruction, including the following steps: Step 1, receiving incremental data containing a target HTML fragment, wherein the incremental data at least comprises an HTML character string representing a node to be inserted and a selector of a designated father node; Step 2, carrying out tag identification on the HTML character string, and extracting the initial tag name of the HTML character string; Step 3, judging whether the label is a sub-label with a table structure according to the label name, and if the label belongs to the sub-label with the preset table structure, packaging the HTML character string into a corresponding legal container label to form a complete HTML document fragment which can be analyzed; Step 4, analyzing the encapsulated HTML document fragments by using a document object model analyzer to generate temporary document objects; step 5, extracting a target node corresponding to the original HTML character string from the temporary document object; And 6, inserting the extracted target node into a preset position in a father node designated by the selector, and finishing incremental updating. In a second aspect, the present invention provides a Table synchronization device of a remote browser for DOM reconstruction, including: the incremental data receiving module is used for receiving incremental data containing a target HTML fragment, wherein the incremental data at least comprises an HTML character string representing a node to be inserted and a selector for designating a father node; The identification and extraction module is used for carrying out label identification on the HTML character string and extracting the initial label name of the HTML character string; the HTML packaging module judges whether the label is a sub-label with a table structure according to the label name, if the label belongs to the sub-label with the preset table structure, the HTML character string is packaged in the corresponding legal container label to form a complete HTML document fragment which can be analyzed; The analysis generating module is used for analyzing the packaged HTML document fragments by using a document object model analyzer to generate temporary document objects; the extracting node module is used for extracting a target node corresponding to the original HTML character string from the temporary document object; And the node inserting module is used for inserting the extracted target node into a preset position in a father node designated by the selector to finish incremental updating. In a third aspect, the invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of the first aspect when executing the program. In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the method