Method and device for dynamically modifying code of page and storage medium
A page code and page technology, applied in special data processing applications, website content management, instruments, etc., can solve problems such as coverage of customized functions, affecting the use of customized functions, and affecting the normal use of network disks
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0033] In Embodiment 1, the present invention mainly proposes a method for dynamically modifying page codes for the newly added customization function of the browser page of the network disk. The method is proposed based on the DOM rendering process of the network disk page. The page DOM rendering process is as follows: figure 1 As shown, the specific explanation is as follows:
[0034] HTML Parser: HTML parsing;
[0035] DOM Tree: The browser parses HTML into a tree-shaped data structure;
[0036] CSS Parser: style analysis;
[0037] Style Rules: The browser parses CSS into a tree-shaped data structure, namely CSSOM;
[0038] Attachment: Use DOM Tree and Style Rules to build Render Tree;
[0039] Render Tree: Render tree, through which you can know the visible nodes and style information contained in the web page;
[0040] Layout: calculate the geometric information of the nodes according to the generated rendering tree;
[0041] Painting: According to the geometric info...
Embodiment 2
[0049] Embodiment 2 provides specific method steps for step S1 in Embodiment 1, that is, monitoring the life cycle of page DOM rendering, such as image 3 shown, including:
[0050] S101. Use the MutationObserver interface of the browser to monitor the changes in DOM rendering of the page;
[0051] The parameter of the browser MutationObserver interface is a callback function, which will be executed after the specified DOM node sends a change, and will be passed in two parameters, one is the change record array, and the other is the observer object itself, so its monitoring operation and The corresponding processing is executed asynchronously after the execution of other scripts is completed, and after all changes are triggered, the changes are recorded in the array and callbacks are performed uniformly.
[0052] S102. Observing the state of the DOM node tree by using the observer pattern.
[0053] Observer mode is also called publish-subscribe mode. This is a one-to-many o...
Embodiment 3
[0057]Embodiment 3 provides specific method steps for step S2 in Embodiment 1, that is, code injection, such as Figure 4 shown, including:
[0058] S201. Setting trigger logic and injection logic of the source code of the custom function in advance;
[0059] The trigger logic is the trigger function logic that triggers the injection of the source code of the customized function. The injection logic is the specific way of injecting the source code of the customized function. The above logic needs to be preset in the page code in advance.
[0060] S202. The trigger logic is to capture the completion of the DOM node tree rendering;
[0061] The triggering logic is combined with the specific method of monitoring the life cycle of the DOM rendering of the page in the second embodiment, capturing the completion of rendering of the DOM node tree and triggering the custom function source code injection.
[0062] S203. The injection logic is to obtain the context of the injected nod...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More - R&D
- Intellectual Property
- Life Sciences
- Materials
- Tech Scout
- Unparalleled Data Quality
- Higher Quality Content
- 60% Fewer Hallucinations
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2025 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com



