Webpage watermark anti-hiding generation method based on package protection structure
By creating a watermark generation method that wraps a protective structure in a webpage, setting the highest priority style, and listening to changes in hierarchy and attributes, the method automatically restores damaged watermarks, solving the problem of watermarks being hidden, weakened, or removed, and achieving stability and effectiveness in webpage information protection and traceability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SI-TECH INFORMATION TECH CO LTD
- Filing Date
- 2025-12-31
- Publication Date
- 2026-05-26
AI Technical Summary
Existing webpage watermarking technologies are difficult to effectively defend against attacks from browser developer tools, resulting in watermarks being hidden, weakened, or removed, affecting the effectiveness and stability of information protection and traceability.
A web page watermark generation method based on a wrapper protection structure is adopted. By creating a watermark load layer and a protection layer, setting the highest priority style, and listening for changes in layer and attribute, the damaged watermark is automatically restored.
It achieves stability and effectiveness of watermarking in web page information protection and source tracing, resists common attack methods, and ensures the continuous coverage and anti-concealment capability of watermarks on client pages.
Smart Images

Figure CN122087785A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of web page content protection technology, specifically to a method for generating web page watermarks to prevent concealment based on a wrapper protection structure. Background Technology
[0002] Webpage watermarking is a common content protection and traceability method, typically used to overlay markings on sensitive information or copyrighted content at the webpage display layer. This provides clues for subsequent accountability and auditing evidence collection in the event of screenshots, screen recordings, or page content leaks. Current webpage watermark generation methods mainly fall into two categories: server-side generation and front-end generation. One method involves the server generating a watermark image and sending it to the client-side page for use; the other involves the front-end generating the watermark within the client-side page. Front-end generation often involves repeatedly creating multiple HTML elements containing the watermark content, or using HTML5's canvas drawing capabilities to convert the watermark content into an image for tiling and overlay. The watermark is ultimately presented on the client-side page in the form of text, images, or element background images, and is covered on top of the protected content using CSS cascading and positioning, while pointer event passthrough is set to reduce the impact on the user experience. In the above basic solution, if only the generation and overlay of the watermark are completed, it is often difficult to resist the risk of attack brought by debugging methods such as browser developer tools. Attackers can reduce the existence, visual visibility, recognizability, information accuracy or coverage effectiveness of the watermark by removing watermark elements, modifying styles, reducing transparency, adding blur filters, changing position and hierarchical relationship, thereby weakening or losing the protective role of the watermark on web page information. To enhance resistance to removal, some upgrade solutions introduce monitoring mechanisms based on page element changes. For example, they use MutationObserver to monitor changes in the attributes or nodes of the watermark-carrying element. When a modification or removal of the watermark element is detected, the corrupted watermark element is deleted and a new, identical watermark-carrying element is regenerated to maintain the watermark's continuous appearance. However, these monitoring and recovery approaches are typically designed for scenarios where the watermark element is directly removed or its inline styles are directly rewritten. Hidden paths that can be bypassed still exist. For instance, attackers can use HTML attributes with hidden effects to prevent the watermark from displaying. It is evident that attackers can weaken watermarks by increasing the CSS selector weight, causing external styles to override the visibility parameters of the watermark element in the final rendered effect, thus weakening the watermark without triggering or significantly triggering existing recovery strategies. Furthermore, attackers can also change parameters such as the layer or position of the protected content container, causing the protected content to overlap the watermark or become misaligned with it, rendering the watermark coverage relationship ineffective and affecting the watermark's effective protection and source tracing credibility. Therefore, a dynamic watermark generation solution with multiple adversarial capabilities is needed to ensure the effectiveness and stability of watermarks in web information protection and source tracing. Summary of the Invention
[0003] To address the shortcomings of existing technologies, this invention provides a webpage watermark anti-hiding generation method based on a wrapper protection structure, which solves the problem of traditional methods lacking an effective detection and self-recovery mechanism for watermarks being hidden, weakened, or removed.
[0004] To achieve the goal mentioned in the background section of ensuring the effectiveness and stability of watermarks in web page information protection and source tracing, the present invention provides the following technical solution: A method for generating webpage watermarks to prevent concealment based on a wrapper protection structure includes: S1: Determine the source of the watermark information, draw the watermark content on the canvas, and generate watermark image data; S2: Create a watermark load layer element, set the display and visibility, transparency, filter, positioning, size, layer, transformation and pointer pass-through parameters inline, write the highest priority declaration, and set the watermark image data as background tiling inline. S3: Create a watermark wrapping layer and a watermark protection layer. Place the content to be protected into the protection layer. Set the relative positioning of the wrapping layer inline and the relative positioning, zero offset, follow the width and height of the parent layer, zero inner and outer margins, and automatic overflow of the protection layer inline. Write the highest priority declaration and place the watermark load layer above the protection layer. S4: Start a change listener for the watermark wrapper layer, listen for changes in its own style attribute, listen for deletion of subtree nodes, and listen for changes in the style and hidden attributes; S5: When the listener is triggered and an unauthorized removal or attribute modification operation is detected, the listener is paused. If the target is a wrapping layer, its inline style is reset. If the target is a load layer, it is removed and regenerated with a preset watermark style. If the target is a protection layer, its inline style is reset, and then the listener is resumed.
[0005] In a preferred embodiment, determining the watermark coverage area and the source of the watermark information, and drawing the watermark content on the canvas to generate watermark image data includes: The coverage area of the watermark layer depends on the original layout of the webpage content. The size of the protected area can be adaptively set by the wrapping structure and relative size units. Standardize the splicing of conversation fields, page fields, or other custom fields, and draw watermark information units according to preset font, rotation angle, color and spacing parameters, and preset watermark unit size. Export image data in dataURL format and temporarily store it in a memory variable.
[0006] In a preferred embodiment, a watermark load layer element is created, and inline settings are made for display and visibility, transparency, filter, positioning, size, layer, transformation, and pointer pass-through parameters, including: Read the temporary watermark image data identifier and watermark unit size, dynamically generate a watermark load layer and insert it into the wrapping layer, and write the node reference into a memory variable.
[0007] In a preferred embodiment, a highest priority style declaration is written, and the watermark image data is set to background tiling within the line, including: Write CSS properties and corresponding preset property values for the display and visibility, transparency, filter, positioning, offset, size, layer, transformation and pointer penetration parameters of the inline style of the watermark load layer, and assign them the highest priority mark; In a container scenario, the watermark payload layer is set to have zero offset distance relative to the container and its width and height are set to adapt to the container size by 100% based on the container positioning context. Configure the background image source as tiled and set the background positioning reference and unit size, and assign the highest priority mark to key background attributes; After completing the readiness check, maintain the insertion state and pass the node reference.
[0008] In a preferred embodiment, the statically pre-created watermark wrapping layer and watermark protection layer include: The watermark wrapping layer is statically pre-generated and its relative positioning is written in the inline style, or other non-static positioning methods are used according to the use case, and the highest priority mark is assigned. The wrapping layer node reference is stored in memory. Based on the layout characteristics of the webpage itself, the wrapping layer can be fixed in position relative to the viewport, or it can scroll within the page following the protected content. No additional special processing is required; it can simply be designed to follow the layout position of the protected content within the page. Assign the highest priority flag to critical inline styles.
[0009] In a preferred embodiment, the content to be protected is placed in a protective layer. The protective layer is set with inline style, relative positioning, zero offset, width and height 100% following the parent layer, zero margins, and automatic overflow. A highest priority declaration is written, and a watermark load layer is placed above the protective layer, including: A statically pre-generated watermark protection layer is created, and the content to be protected is placed within it. Write relative positioning, zero offset, follow the parent layer's width and height, zero margin, and automatic inline style for overflow to the protection layer and assign it the highest priority flag; Insert the watermark load layer into the wrapping layer and place it above the protective layer.
[0010] In a preferred embodiment, a change listener is initiated for the watermark wrapping layer, listening for changes in its own style attribute, removal of its subtree nodes, and changes in the style and hidden attributes, including: After validating the references to the wrapping layer, bind the change listener to the wrapping layer and set the listening scope to cover its subtree; Monitor changes to child nodes, including deletions and changes to the `style` and `hidden` attributes. The target node attribution is determined by comparing the document object model references and change trigger source objects of the wrapper layer, load layer, and protection layer, and changes to business content within the protection layer are excluded from the scope of processing.
[0011] In a preferred embodiment, when a removal or attribute modification operation is identified as disallowed after the listener is triggered, the listener is paused. If the target is a load layer, the load layer is removed and the inline style is regenerated according to a preset watermark style. If the target is a protection layer, its inline style is reset. If the target is a wrapping layer, its inline style is reset. Then the listener is resumed, including: When a listener detects a disallowed removal or property modification operation after the listener is triggered, the listener is paused to allow for self-repair and restoration operations without entering a loop of change responses. The load layer target performs a cleanup operation based on the insertion position information, then rebuilds and re-inserts the load layer node, and updates the node references; For the protective layer target, perform inline style reset according to the assembly reference; For the wrapping layer target, perform inline style reset according to the assembly baseline; After the restore operation is complete, resume listening and enter monitoring mode.
[0012] Compared with existing technologies, this invention provides a webpage watermark anti-hiding generation method based on a wrapper protection structure, which has the following beneficial effects: 1. This invention decouples the watermark load layer from the protected content into a structure of a wrapper layer plus a protective layer. It prioritizes and solidifies key parameters such as display, transparency, filters, positioning, size, hierarchy, overflow, and pointer penetration for inline styles related to the visibility of the load and protective layers. This makes it difficult for external stylesheets to alter the watermark's coverage and visibility when increasing selector weights or injecting styles. Simultaneously, it uses the wrapper layer as a monitoring entry point to filter and monitor node deletions and changes in the style and hidden attributes of its subtrees. Watermark-related changes are categorized as load layer targets, protective layer targets, or wrapper layer targets. Within the processing window, monitoring is paused before executing load layer cleanup, reconstruction, and re-insertion, or protective layer style reset or wrapper layer style reset and reconstruction, and finally, monitoring resumes. This forms a closed-loop processing chain that can resist concealment methods such as removal, hiding, weakening, and misalignment. Ultimately, this ensures that the webpage watermark maintains stable coverage and continuous anti-concealment capabilities on the client-side page, thus solving the problem of traditional methods lacking effective detection and self-recovery mechanisms for watermark hiding, weakening, or removal.
[0013] 2. This invention, by sequentially migrating the original page's target content nodes to the protection layer during the assembly phase while retaining anchor point mappings and necessary node identifiers, ensures that the page structure and existing event bindings remain consistent before and after watermark deployment. This avoids the interactive chaos or script path failure caused by changes in insertion levels in traditional watermark overlay schemes. Simultaneously, during the listening phase, it focuses only on node deletion in the wrapper layer subtree and changes in the style and hidden attributes, reducing false triggers and redundant processing caused by irrelevant business rendering changes. Combined with load layer pointer penetration and protection layer scrolling strategy solidification, watermark overlay does not interfere with page operations and scrolling links, ultimately achieving a simultaneous improvement in watermark anti-hiding processing and business page compatibility. Attached Figure Description
[0014] Figure 1 This is a schematic diagram of the process for generating a webpage watermark to prevent concealment based on a wrapper protection structure, according to the present invention. Detailed Implementation
[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0016] Example 1: Figure 1A method for generating webpage watermarks to prevent concealment based on a wrapper protection structure is presented, including: S1: Determine the source of the watermark information, draw the watermark content on the canvas, and generate watermark image data; S2: Create a watermark load layer element, set the display and visibility, transparency, filter, positioning, size, layer, transformation and pointer pass-through parameters inline, write the highest priority declaration, and set the watermark image data as background tiling inline. S3: Create a watermark wrapping layer and a watermark protection layer. Place the content to be protected into the protection layer. Set the relative positioning of the wrapping layer inline and the relative positioning, zero offset, follow the width and height of the parent layer, zero inner and outer margins, and automatic overflow of the protection layer inline. Write the highest priority declaration and place the watermark load layer above the protection layer. S4: Start a change listener for the watermark wrapper layer, listen for changes in its own style attribute, listen for deletion of subtree nodes, and listen for changes in the style and hidden attributes; S5: When the listener is triggered and an unauthorized removal or attribute modification operation is detected, the listener is paused. If the target is a wrapping layer, its inline style is reset. If the target is a load layer, it is removed and regenerated with a preset watermark style. If the target is a protection layer, its inline style is reset, and then the listener is resumed.
[0017] S1: Determine the source of the watermark information, draw the watermark content on the canvas to generate watermark image data, specifically as follows: The business page extracts watermark information elements from session information and page information. The watermark information elements include login subject identifier, page path identifier, and access time element, and can optionally overlay business order number or custom fields according to configuration rules. After standardizing each element, they are concatenated in a preset order to generate watermark text. The access time adopts a uniform format, the page path adopts a standardized route identifier or resource identifier, and the business order number adopts the business primary key bound to the page. The configuration rules, field definitions, desensitization rules, and drawing parameters are loaded by the page initialization configuration object. The configuration object is provided by the front-end constant configuration or issued by the back-end and written into the page-level state. Create a canvas object, using an off-screen canvas or a memory canvas node; set the logical width and height of the canvas based on the preset watermark unit size or the dynamically calculated watermark information display size, and set the actual pixel width and height according to the device pixel ratio; scale the drawing context proportionally, and set the canvas background to transparent; set the watermark unit pattern parameters, including font, font size, font weight, rotation angle, color transparency, repeat spacing, and watermark unit size; the watermark unit pattern parameters are used to draw a single watermark unit image on the canvas; After drawing is completed, the canvas is exported as image / png as dataURL image data, and the image data, device pixel ratio parameters, and watermark unit size are written to the temporary storage area. The temporary storage area uses a memory cache object or a page-level state container, and is saved with a combination of login subject identifier and page path identifier as the index key. During page operation, when a change in session elements is detected, the image data is regenerated and the temporary storage record is replaced. Changes in session elements include changes in page routing and switching of business order number.
[0018] S2: Create a watermark payload layer element, set the display and visibility, transparency, filter, positioning, size, layer, transformation, and pointer pass-through parameters inline, write the highest priority declaration, and set the watermark image data as background tiling inline. Specifically: After the watermark image data is temporarily stored, the page script context reads the image data identifier and watermark unit size parameters from the temporary storage area as the load layer style configuration and background laying diameter; then, the watermark load layer node is dynamically created. The load layer adopts block-level container nodes, and the node reference is written into the memory variable for assembly positioning, listening and classification.
[0019] Next, configure the inline style of the load layer; the load layer is absolutely positioned relative to the wrapping layer and set to zero offset, and the size-related properties are set to 100% to adapt to the width and height range of the wrapping layer; then write inline styles such as display and visibility, transparency, filters, layer, transformation and pointer passthrough, etc., set pointer passthrough to not participate in event hits, take the layer level higher than the protection layer level configuration value, and attach the highest priority flag when writing; The payload layer is then configured, and the image data identifier is written to the background image source. The background is set to tiled, and the background unit size is calibrated according to the watermark unit size and combined with the device pixel ratio and usage scenario. The background abbreviation attribute is used to include all background-related attribute settings such as background color, background image source, background repetition, background positioning and background size, and written to the highest priority flag. After the load layer node is created and all predefined inline styles are set, it remains in the state of waiting to be inserted. The reference of the load layer node is passed to the next step, which will then complete the insertion according to the stacking relationship after the wrapping layer and the protective layer are established.
[0020] S3: Create a watermark wrapping layer and a watermark protection layer. Place the content to be protected into the protection layer. Set the relative positioning of the wrapping layer within the line. Set the relative positioning, zero offset, follow the width and height of the parent layer, zero inner and outer margins, and automatic overflow of the protection layer within the line. Write the highest priority declaration, and place the watermark load layer above the protection layer. The specific implementation is as follows: After the page enters the initialization process, the script context obtains the node references of the watermark wrapper layer and the watermark protection layer and performs accessibility verification to confirm that they are mounted in the page node tree and can be read and written by the script. The wrapper layer and the protection layer are pre-placed in the business area to be watermarked during the page source code stage. At the same time, the node references of the wrapper layer and the protection layer are written to memory variables for subsequent listening, location and recovery processing. The key inline styles of the wrapper layer and the protection layer are appended with the highest priority declaration when written. In the source code stage, the current wrapping layer style is set according to the expected style of the container containing the content to be protected when the watermark wrapping structure is not implemented, so as to adapt the watermark coverage area to the visible area or follow the business content container. Only the inline style of the wrapping layer is required to set the positioning, and the positioning method is a non-static value, with the highest priority declaration attached. Then configure the inline style of the protective layer. Initially, it can be statically preset directly in the source code stage, or it can be dynamically set through the script at the time of page loading. Set the protective layer to relative positioning, with zero offset on all four sides, adaptive width and height with the parent layer, and zero inner and outer margins; set overflow to automatic; write the key inline styles of the protective layer such as positioning, offset, width and height, margins, transformation and overflow into the highest priority declaration. After the styles and sizes of the wrapping layer and the protective layer are fixed, the watermark load layer generated in the previous stage and in the state of waiting to be inserted is inserted into the wrapping layer, so that the load layer and the protective layer become sibling nodes under the same parent container; after assembly, a stacked structure is formed with the protective layer at the bottom and the load layer at the top.
[0021] S4: Initiate change monitoring for the watermark wrapper layer, monitoring changes to its own style attribute, deletion of subtree nodes, and changes to the style and hidden attributes. Specifically, the implementation is as follows: After the wrapper layer, protective layer, and load layer are assembled and the load layer is located above the protective layer, the page script context starts the change listening establishment process; it reads the wrapper layer node reference and verifies that its object exists, is mounted in the page node tree, and can be read and written by the script; after the verification is passed, a listening context object is generated, and the wrapper layer reference, load layer reference, and protective layer reference are written to it, which serve as the entry point for subsequent classification, back-insertion positioning, and restoration. Initialize change listeners and bind them to the wrapper node, covering the wrapper and its subtree; enable child node list listeners to capture structural changes such as additions, removals, and replacements; enable attribute change listeners and limit attribute filters to style and hidden. Once the listener is running, it triggers a listener callback when it detects a change within its listening range. The callback iterates through the browser-injected change list, then determines the type of change based on the relevant information for each change, storing the change identifier in a change type identifier variable. Each change in the browser-injected change list contains corresponding information, including the change type, the target node reference, the list of removed node references, the changed attribute name, and the old value of that attribute. If the first item in the removed node reference list equals a load layer node reference, a load layer removal identifier is stored. If the target node reference equals a load layer node reference, a load layer attribute change identifier is stored. If the target node reference equals a protector node reference, and the changed attribute name equals `style`, a protector attribute change identifier is stored. If the target node reference equals a wrapper node reference, and the changed attribute name equals `style`, and its positioning attribute is calculated as `static`, a wrapper attribute change identifier is stored.
[0022] S5: When a listener detects an unauthorized removal or attribute modification operation after it is triggered, the listener is paused. If the target is a wrapping layer, its inline style is reset. If the target is a load layer, it is removed and regenerated with a pre-defined watermark style. If the target is a protection layer, its inline style is reset, and then the listener is resumed. The specific implementation is as follows: After generating a change type identifier in the change listener callback, the next step of processing is carried out in the callback based on the change identifier; if the change type identifier is empty, the processing is skipped directly; otherwise, the specific processing window is entered. After entering the processing window, the listener stops observing the wrapper layer to prevent the processing action from triggering the callback again; then, the wrapper layer target, load layer target and protection layer target are processed separately according to the change type identifier. After the processing is completed, the corresponding new node for the load layer target is inserted back into the predetermined position of the wrapper layer, and the node reference in the listening context object is updated. When the change identifier is a wrapper attribute change identifier, read the positioning key inline style in the handling baseline, restore the corresponding style of the wrapper to the baseline value and rewrite it into the highest priority declaration. The wrapper reference remains unchanged and continues to be used as the listener binding target. When the change flag is a load layer attribute change flag, the current load layer node is removed. After removal, the load layer node is rebuilt, and key inline styles and key background attributes are configured according to the preset watermark style caliber and written into the highest priority declaration; the background image source and watermark unit size are read from the temporary storage area, and background attributes such as background tiling, background positioning reference, and background unit size are written into the highest priority declaration; once the load layer node is ready, it is inserted into the end position inside the wrapper layer, and the reference of the new load layer node is written back to the listening context object; When the change flag is the load layer removal flag, the load layer attribute change process above will be followed, but the removal and cleanup operation will not be performed. Instead, the reconstruction and insertion operation will be performed directly, and the load layer node reference in the listening context object will be updated. When the change identifier is a protection layer attribute change identifier, if the protection layer node is accessible, its relative positioning, zero offset, following the width and height of the parent layer, zero margin and automatic overflow and other key inline styles will be restored according to the handling reference standard. The key styles will be written with the highest priority declaration. The protected content nodes in the protection layer remain unchanged, and the protection layer node references remain unchanged. After the branch processing is completed, the listeners are rebound to the wrapping layer, and the wrapping layer's own style attribute listener and the node deletion listener and style and hidden attribute listener within the subtree are restored. The listener status is set to running, so that the processing flow triggered by subsequent changes is executed in a loop.
[0023] In this embodiment, after the page is initialized and the document object model is accessible, the login subject identifier, page path identifier, and access time elements are extracted from the session and page information to generate watermark text. Watermark units are drawn on the canvas and transparent background image data is exported via dataURL and written to the temporary storage area. Then, a watermark load layer is created, and inline styles such as display and visibility, positioning, size, layer, and pointer penetration are set and assigned the highest priority. The image data is configured as background tiling and assigned the highest priority. Then, a wrapping layer and a protection layer are assembled. The target content is attached to the protection layer in its original order, and the load layer is placed on top of it. The wrapping layer establishes its own and its subtree listeners to monitor node deletion and style and hidden changes. If an unallowed change operation is triggered, the listening is paused, the wrapping layer or protection layer style is reset according to its affiliation, the load layer is cleaned up, rebuilt, and reinserted. After completion, the listening is resumed and continuous monitoring begins.
[0024] It should be noted that this invention can be deployed on the device itself to realize embedded applications, or it can run on a PC or other terminal with a user interface, thereby meeting various hardware environments and usage requirements.
[0025] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wireless or wired transmission; wired transmission methods include optical fiber, twisted pair, coaxial cable, etc.; wireless transmission includes infrared, microwave, etc. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center containing one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.
[0026] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0027] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0028] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0029] In addition, the functional modules in the embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0030] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0031] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0032] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for generating webpage watermarks to prevent concealment based on a wrapper protection structure, characterized in that, include: S1: Determine the source of the watermark information, draw the watermark content on the canvas, and generate watermark image data; S2: Create a watermark load layer element, set the display and visibility, transparency, filter, positioning, size, layer, transformation and pointer pass-through parameters inline, write the highest priority declaration, and set the watermark image data as background tiling inline. S3: Create a watermark wrapping layer and a watermark protection layer. Place the content to be protected into the protection layer. Set the relative positioning of the wrapping layer inline and the relative positioning, zero offset, follow the width and height of the parent layer, zero inner and outer margins, and automatic overflow of the protection layer inline. Write the highest priority declaration and place the watermark load layer above the protection layer. S4: Start a change listener for the watermark wrapper layer, listen for changes in its own style attribute, listen for deletion of subtree nodes, and listen for changes in the style and hidden attributes; S5: When the listener is triggered and an unauthorized removal or attribute modification operation is detected, the listener is paused. If the target is a wrapping layer, its inline style is reset. If the target is a load layer, it is removed and regenerated with a preset watermark style. If the target is a protection layer, its inline style is reset, and then the listener is resumed.
2. The webpage watermark anti-hiding generation method based on a wrapper protection structure according to claim 1, characterized in that, Determine the source of the watermark information, draw the watermark content on the canvas to generate watermark image data, including: The coverage area of the watermark layer depends on the original layout of the webpage content. The size of the protected area can be adaptively set by the wrapping structure and relative size units. Standardize the splicing of conversation fields, page fields, or other custom fields, and draw watermark information units according to preset font, rotation angle, color and spacing parameters, and preset watermark unit size. Export image data in dataURL format and temporarily store it in a memory variable.
3. The webpage watermark anti-hiding generation method based on a wrapper protection structure according to claim 1, characterized in that, Create a watermark load layer element, and set its display and visibility, transparency, filter, positioning, size, layer, transformation, and pointer drop-through parameters inline, including: Read the temporary watermark image data identifier and watermark unit size, dynamically generate a watermark load layer and insert it into the wrapping layer, and write the node reference into a memory variable.
4. The webpage watermark anti-hiding generation method based on a wrapper protection structure according to claim 1, characterized in that, Write the highest priority style declaration and set the watermark image data to background tiling within the line, including: Write CSS properties and corresponding preset property values for the display and visibility, transparency, filter, positioning, offset, size, layer, transformation and pointer penetration parameters of the inline style of the watermark load layer, and assign them the highest priority mark; In a container scenario, the watermark payload layer is set to have zero offset distance relative to the container and its width and height are set to adapt to the container size by 100% based on the container positioning context. Configure the background image source to tile and set the background positioning reference and unit size, and assign the highest priority mark to key background attributes; After completing the readiness check, maintain the insertion state and pass the node reference.
5. The webpage watermark anti-hiding generation method based on a wrapper protection structure according to claim 1, characterized in that, Static pre-created watermark wrapping layer and watermark protection layer, including: The watermark wrapping layer is statically pre-generated and its relative positioning is written in the inline style, or other non-static positioning methods are used according to the use case, and the highest priority mark is assigned. The wrapping layer node reference is stored in memory. Based on the layout characteristics of the webpage itself, the wrapping layer can be fixed in position relative to the viewport, or it can scroll within the page following the protected content. No additional special processing is required; it can simply be designed to follow the layout position of the protected content within the page. Assign the highest priority flag to critical inline styles.
6. The webpage watermark anti-hiding generation method based on a wrapper protection structure according to claim 1, characterized in that, Place the content to be protected within a protective layer. Set the protective layer's inline style to relative positioning, zero offset, 100% width and height following the parent layer, zero margins, and automatic overflow. Write a highest priority declaration and place the watermark payload layer above the protective layer, including: A statically pre-generated watermark protection layer is created, and the content to be protected is placed within it. Write relative positioning, zero offset, follow the parent layer's width and height, zero margin, and automatic inline style for overflow to the protection layer and assign it the highest priority flag; Insert the watermark load layer into the wrapping layer and place it above the protective layer.
7. The webpage watermark anti-hiding generation method based on a wrapper protection structure according to claim 1, characterized in that, Start a change listener for the watermark wrapper layer, listening for changes in its own style attribute, removal of its subtree nodes, and changes in the style and hidden attributes, including: After validating the references to the wrapping layer, bind the change listener to the wrapping layer and set the listening scope to cover its subtree; Monitor changes to child nodes, including deletions and changes to the `style` and `hidden` attributes. The target node attribution is determined by comparing the document object model references and change trigger source objects of the wrapper layer, load layer, and protection layer, and changes to business content within the protection layer are excluded from the scope of processing.
8. The webpage watermark anti-hiding generation method based on a wrapper protection structure according to claim 1, characterized in that, When a listener is triggered and an unauthorized removal or attribute modification operation is detected, the listener pauses. If the target is a load layer, the load layer is removed and the inline style is regenerated according to the preset watermark style. If the target is a protection layer, its inline style is reset. If the target is a wrapping layer, its inline style is reset. Then the listener resumes, including: When a listener detects a disallowed removal or property modification operation after the listener is triggered, the listener is paused to allow for self-repair and restoration operations without entering a loop of change responses. The load layer target performs a cleanup operation based on the insertion position information, then rebuilds and re-inserts the load layer node, and updates the node references; For the protective layer target, perform inline style reset according to the assembly reference; For the wrapping layer target, perform inline style reset according to the assembly baseline; After the restore operation is complete, resume listening and enter monitoring mode.