Method, device, equipment and medium for displaying page information
By identifying and parsing nodes of third-party H5 pages, obtaining modification policies and making modifications, the problem that third-party H5 pages cannot be modified is solved, and the reliability of native apps and user traffic protection is achieved.
Patent Information
- Application Number
- CN202110867384.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-28
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2041-07-28
AI Technical Summary
In the prior art, the H5 page provided by a third party cannot be modified, which affects the reliability of the native app, especially due to the traffic loss caused by traffic diversion advertisements and violation information.
When receiving a load request, the resource identifying the target page meets the preset conditions, analyzes each node based on the preset rules, determines and obtains the modification strategy, modifies the target page, and displays the modified page.
It effectively avoids traffic loss from native apps, retains partial integrity of the page, and only modifies unfavorable information without blocking the overall page loading.
Smart Images

Figure CN115687815B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of computer technology, specifically to the field of cloud computing technology, and more particularly to a method, apparatus, device, and medium for displaying page information. Background Art
[0002] An H5 page is a markup specification that includes HTML5. It can realize a variety of dynamic effects and audio-visual effects, and will utilize a variety of back-end and front-end functions. It is mainly disseminated on smart mobile terminals and can be browsed on PCs and tablets across platforms.
[0003] In related technologies, if the currently loaded H5 page is provided by a third party, it cannot be modified, which seriously affects the reliability of the native App. Summary of the Invention
[0004] In view of the above-mentioned defects or deficiencies in the prior art, it is desired to provide a method, device, equipment and medium for modifying page information to effectively modify the H5 page provided by a third party.
[0005] In a first aspect, an embodiment of the present application provides a method for displaying page information, the method comprising:
[0006] Upon receiving a target page loading request, identifying that resources of the target page meet a preset condition;
[0007] Parsing each node in the target page based on preset rules to obtain a return value corresponding to each node;
[0008] Determine the target node that needs to be modified in the target page according to the return value corresponding to the node, and obtain the modification strategy corresponding to the target node according to the return value corresponding to the target node;
[0009] The target page is modified based on the modification strategy to obtain a modified target page, and the modified target page is displayed.
[0010] In a second aspect, an embodiment of the present application provides a device for displaying page information, the device comprising:
[0011] A receiving module, configured to, upon receiving a load request for a target page, identify whether the resources of the target page meet a preset condition;
[0012] A parsing module, configured to parse each node in the target page based on preset rules to obtain a return value corresponding to each node;
[0013] A determination module, configured to determine a target node that needs to be modified in the target page according to a return value corresponding to the node, and obtain a modification strategy corresponding to the target node according to the return value corresponding to the target node;
[0014] The loading module is used to modify the target page based on the modification strategy to obtain a modified target page, and display the modified target page.
[0015] In some embodiments, the receiving module is further configured to:
[0016] Extracting the resource locator in the load request;
[0017] When the resource locator does not match the internal resource list, it is determined that the target page meets a preset condition.
[0018] In some embodiments, the parsing module is further configured to:
[0019] Input the nodes in the target page one by one into the corresponding template function, wherein the template function is used to return the situation where the node has unfavorable information;
[0020] A return value corresponding to the node is acquired according to whether the node has unfavorable information.
[0021] In some embodiments, the parsing module is further configured to:
[0022] Obtaining the target attribute of the root node;
[0023] According to the target attribute, all nodes of the same type as the root node in the target page are obtained, and a node data set is generated;
[0024] The node data set is input into a template function corresponding to the target attribute.
[0025] In some embodiments, the determining module is further configured to:
[0026] When it is identified that the type of the return value is not a preset type, the node corresponding to the return value is determined to be the target node, wherein the preset type is an object type with an empty value.
[0027] In some embodiments, the determining module is further configured to:
[0028] Sending the return value to a server, wherein the server is configured to determine a modification strategy corresponding to the target node according to the return value;
[0029] Receive a modification strategy determined by the server according to the return value.
[0030] In some embodiments, the communication module is further configured to communicate with the server based on a native interface and determine:
[0031] Convert the return value to the data type corresponding to the native interface to obtain an intermediate return value;
[0032] Performing function encoding on the intermediate return value to obtain a character string corresponding to the return value;
[0033] The character string is sent to the server, and the server is configured to determine a modification policy corresponding to the target node based on the character string.
[0034] In some embodiments, the modification strategy includes replacement and deletion. When the modification strategy is deletion, the loading module is further configured to:
[0035] Obtaining a target distance between the target node and the previous node;
[0036] The distance between the node following the target node and the node preceding the target node is modified to the target distance.
[0037] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the embodiment of the present application when executing the program.
[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, which, when executed by a processor, implements the method described in the embodiment of the present application.
[0039] When receiving a loading request for a target page and determining an external page of the target page, the present application parses the nodes in the target page based on preset rules to obtain the target node that needs to be modified, and then modifies the target node in the target page, so that when there is unfavorable information in the target page, only the unfavorable information can be modified, thereby retaining the partial integrity of the target page and avoiding the entire page from being blocked from loading.
[0040] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Other features, objects and advantages of the present application will become more apparent upon reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0042] Figure 1a A schematic diagram of an application scenario of an embodiment of the present application;
[0043] Figure 1b This is a schematic diagram of another application scenario of an embodiment of the present application;
[0044] Figure 2 A flowchart of a method for displaying page information proposed in an embodiment of the present application;
[0045] Figure 3 A flowchart of another method for displaying page information proposed in an embodiment of the present application;
[0046] Figure 4 A flowchart of another method for displaying page information proposed in an embodiment of the present application;
[0047] Figure 5 A flowchart of another method for displaying page information proposed in an embodiment of the present application;
[0048] Figure 6 A block diagram of another device for displaying page information proposed in an embodiment of the present application;
[0049] Figure 7 A schematic diagram of the structure of a computer system of an electronic device or server suitable for implementing an embodiment of the present application is shown. DETAILED DESCRIPTION
[0050] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the invention are shown in the accompanying drawings.
[0051] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0052] With the widespread adoption of smart mobile devices, people are increasingly using them for web browsing. When browsing the web, users sometimes browse H5 pages provided by native apps, while other times they browse H5 pages provided by third-party servers. For example, after a user first opens the H5 page for JD Shopping within WeChat using the JD Mini Program provided by WeChat, if they then click on the recommended product icon, the H5 page will redirect to an H5 page provided by JD (a third-party server).
[0053] Since H5 pages provided by third parties usually contain diversion advertisements that are beneficial to the third parties, if they are displayed normally, it is easy to cause traffic loss to native apps (such as WeChat); in order to prevent certain H5 pages provided by third parties from containing information that violates laws and regulations, it is necessary to block or replace the illegal data in the H5 pages provided by third parties.
[0054] Based on this, the present application proposes a method, apparatus, device and medium for displaying page information.
[0055] Figure 1a and 1b This is a schematic diagram of the application scenario of the embodiment of the present application. Figure 1a and 1b As shown, the application scenario includes at least a terminal 1, a server 2 corresponding to the native App, and a third-party server 3.
[0056] Among them, server 2 and third-party server 3 can be independent physical servers, 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, CDN, and big data and artificial intelligence platforms. Terminal 1 can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, and this application does not impose any restrictions on this.
[0057] When a user opens an H5 page using the native App client installed on terminal 1, the first page that is usually opened is the H5 page provided by the native App server, for example Figure 1b (a) is a shopping page developed by the native App team. When users browse the initial H5 page, they can jump to the shopping page of a specific product provided by a third party by continuously clicking on the information provided on the initial H5 page. Figure 1b As shown in (b), at this time, although the information of the shopping page is provided by a third-party server (shopping platform), the user is still browsing the page using the native App client, and there is no user diversion. However, due to Figure 1b In (b), there is a jump control such as "Open XXAPP". If the user clicks the jump control while browsing the page, the user will be redirected to the application provided by the third party, resulting in traffic loss of the native app.
[0058] Therefore, in this application, terminal 1 receives the target page (H5 page to be displayed) sent by the third-party server 3, and then performs modification demand detection on each node in the target page. After identifying the node that needs to be modified, the return value of the node to be modified is sent to server 2 to obtain the modification strategy for the target node, and the target page is modified according to the modification strategy, and the modified target page is displayed after the modification, for example Figure 1b In (c), the final target page does not have any diversion controls, effectively avoiding the loss of user traffic of the native app.
[0059] Figure 2 This is a flowchart of a method for displaying page information proposed in an embodiment of the present application.
[0060] It should be noted that the executor of the page information display method of this embodiment is the page information modification device, which can be implemented by software and / or hardware. The page information modification device in this embodiment is configured in the native App installed in the terminal.
[0061] Step 101: upon receiving a target page loading request, identifying whether resources of the target page meet preset conditions.
[0062] It should be noted that in the embodiment of the present application, the target page is an H5 page, and a native App client is installed in the terminal. The native App client creates an H5 processing center H5handle when it starts. The H5handle is used to process data interacting with the server (including the server and third-party servers) when the H5 page is loaded and handles the callback information of the loading. The H5handle can monitor callback information such as the start of H5 page loading, loading completion, loading failure, redirection, etc.
[0063] After the native app client is started, the server sends internal connections and template functions to the native app client. The internal connections are stored in the permit collection to form an internal resource list. The template function is a JavaScript function script that uses the JSContext in jscore to generate an execution environment. When modifying the target node, the template function is executed through JSContext to implement the modification of the target node.
[0064] During the process of loading the target page, the URL (Uniform Resource Locator) corresponding to the target page can be obtained. The URL is used to identify the resource location and access method of the target page.
[0065] In one or more embodiments, identifying that the resource of the target page meets the preset condition includes: extracting a resource locator in the loading request, and determining that the target page meets the preset condition when the resource locator does not match the internal resource list.
[0066] Specifically, upon receiving a request to load a target page, the URL corresponding to the loaded target page is matched with the internal resource list issued by the server. If the resource location recorded in the URL corresponding to the target page matches the corresponding information in the internal resource list, the target page is determined to be an internal page. If the resource location recorded in the URL corresponding to the target page does not match the corresponding information in the internal resource list, the target page is determined to meet the preset conditions. Whether the URL matches the internal resource list can be determined based on whether the internal resource list contains resource information with the same name as the URL, or the same resource path.
[0067] Step 102: parse each node in the target page based on preset rules to obtain a return value corresponding to each node.
[0068] The node detected in the target page is the Dom node, which contains information corresponding to an element or element group in the H5 page. An element can be a button, label, or image in the H5 page. It should be understood that Dom nodes are developed and provided by the vendor. That is, when the target page is an internal link, the Dom node is developed and provided by the native app vendor; when the target page is an external link, the Dom node is developed and provided by the third-party server vendor. As development tools evolve and upgrade, the type, attributes, and content of Dom nodes also evolve and change accordingly.
[0069] The preset rules are dynamically edited by developers based on the latest Dom node. A Dom node can correspond to at least one preset rule. For example, when the Dom node is a background image, the preset rules can at least include the color review rules for the background image and the review rules for the background image content. The color review rules for the background image and the review rules for the background image content can also be written in the same preset rule system.
[0070] The return value is used to express the data information of the node. It can be at least a part of the data information corresponding to the node, or it can be a specified value returned according to the set rules based on the data information corresponding to the node for the purpose of desensitization, etc.
[0071] Step 103: Determine the target node that needs to be modified in the target page according to the return value corresponding to the node, and obtain the modification strategy corresponding to the target node according to the return value corresponding to the target node.
[0072] Optionally, the target node that needs to be modified in the target page can be determined based on the data type of the return value corresponding to the node, where the return value type includes but is not limited to an empty object type, an object type with an empty value, a string type, a number type, a dictionary object type, a binary object type, a time object type, etc.
[0073] For example, the node corresponding to the return value of a certain specific type can be used as the target node. For example, the node corresponding to the empty object type can be determined as the target node. It can also be set that the return value of a certain specific type is not the target node, and correspondingly, the return value of other types is the target node. For example, all nodes of other attribute types except the object type with empty value can be determined as target nodes.
[0074] It should be noted that in the embodiments of the present application, when a node does not contain unfavorable information, the corresponding return value of the node is empty, for example, no data is returned. When a node contains unfavorable information, the corresponding return value of the node is not empty, for example, data is returned, and the node is determined to be the target node. Unfavorable information includes but is not limited to diversion advertisements, information that violates laws and regulations, and abnormal data.
[0075] Specifically, the type of the return value of each node is identified. If the type of the return value is "value is empty", it is determined that the node is not the target node. If the type of the return value is other than "value is empty", it is determined that the node is the target node.
[0076] Since the return value can express the data information of the node, the modification strategy of the target node can be further determined according to the return value corresponding to the target node. The modification strategy may include modification and deletion, and the modification may include partial modification and full modification.
[0077] For example, when the node is an advertising image, the return value may only include the node type, that is, the advertising image. At this time, the modification strategy can be to replace the advertising image with the advertising image in the original application, thereby reducing the advertising traffic of the third-party server. It can also be to only modify the color tone of the advertising image, such as adjusting all advertising images to grayscale images on special anniversaries. It can also be deleted when the advertising image contains sensitive information that violates regulations.
[0078] Step 104 : Modify the target page based on the modification strategy to obtain a modified target page, and display the modified target page.
[0079] Specifically, when a loading request for a target page is received, it is identified that the resources of the target page meet the preset conditions, and each node in the target page from the outside is parsed based on the preset rules to obtain the return value corresponding to each node. Then, based on the return value corresponding to the node, the target node that needs to be modified in the target page and the modification strategy of the target node are determined, and the target page is modified based on the modification strategy to obtain the modified target page, and the modified target page is displayed, thereby completing the call to the target page.
[0080] Therefore, when the present application receives a loading request for the target page and determines the external page of the target page, it parses the nodes in the target page based on preset rules to obtain the target node that needs to be modified, and then modifies the target node in the target page, so that when there is unfavorable information in the target page, only the unfavorable information can be modified, thereby retaining the partial integrity of the target page and avoiding the entire page from being blocked from loading.
[0081] In one or more embodiments, Figure 3 As shown, step 102 is to parse each node in the target page based on preset rules to obtain the return value corresponding to each node, including:
[0082] Step 1021: Input the nodes in the target page one by one into the corresponding template function, and the template function is used to return the situation where the node has unfavorable information.
[0083] Step 1022: Obtain a return value corresponding to the node based on whether the node has unfavorable information.
[0084] It's important to note that when a native app launches, the function template delivered by the server is a JavaScript function script. When this function script executes the search function, it can query the DOM node's data in accordance with the template function's rules. Specifically, when initializing JSContext in jscor, the evaluateScript function can be called to enable the template function to perform the search function. It should be understood that the template function used to search for the target node can also be a separate template function.
[0085] Specifically, when the native App is started, the template function sent by the server is received, and the search function of the template function is configured. When the loading request of the target page is received and the target page meets the preset conditions, each Dom node data in the target page is input into the template function respectively, so that the template function can feedback the return value corresponding to the node based on whether there is unfavorable information in the node.
[0086] For example, the nodes on the target page are input one by one into the corresponding template function. The template function queries each node. If the node does not contain any unfavorable information, the template function returns an object tag with a "value of null." If the node contains unfavorable information, the template function returns the data corresponding to the node. The data corresponding to the node may include, but is not limited to, one or more of the following: the node's coordinate location, content, content of the unfavorable information, and attributes of the unfavorable information.
[0087] In one or more embodiments, the target page includes a root node, and the corresponding relationship is a target attribute. The nodes in the target page are input one by one into the corresponding template function, including: obtaining the target attribute of the root node; according to the target attribute, obtaining all nodes in the target page that are of the same type as the root node, and generating a node data set; inputting the node data set into the template function corresponding to the target attribute.
[0088] The target attribute is determined according to the type of the node.
[0089] That is to say, the nodes in the target page can be classified according to their attributes, and then the return value query can be performed on the nodes with the same attributes at one time, thereby effectively improving the efficiency of the return value query and improving the overall speed of loading the target page.
[0090] Specifically, multiple root nodes can be determined from the target page, and then for each root node, the target attribute of the root node can be obtained, and the corresponding calling function can be used to combine all nodes belonging to the attribute in the target page into a node data set. Finally, the node data set is input into the template function corresponding to the target attribute, so that the search function of the template function processes each node in the node data set, obtains the target data corresponding to the entire node data set, and uses the target data as the return value corresponding to the entire node data set.
[0091] For example, when the template function queries the entire node data set, the node without unfavorable information returns an object marker with "value empty", and the node with unfavorable information returns a value that is not empty, which can be the data information corresponding to the node, so that the target node that needs to be replaced in the node data set can be determined based on the return value later.
[0092] Optionally, the query may be completed sequentially for multiple root nodes, that is, after the query for all nodes for one target attribute is completed, the query for all nodes for the next target attribute is executed.
[0093] As a specific embodiment,
[0094] webView.evaluateJavaScript
[0095] ("document.getElementsByClassName('preview-content')[0]")&&
[0096] document.getElementsByClassName('preview-content')[0].innerText.split('.')[0]"){[weak self](result,error)in
[0097] if let text=result as? String{
[0098] self?.shareText=text
[0099] }
[0100] }
[0101] Specifically, the process retrieves the elements with the class attribute "preview-content" and splits them with a period (.) to create an array. If the first element in the array is not empty, the first element in the array is returned as the value. In other words, the split operation separates all nodes with the class attribute "preview-content" that contain unfavorable information into the first element of the array.
[0102] As a possible embodiment, Figure 4 As shown, step 103, according to the return value corresponding to the target node, obtains the modification strategy corresponding to the target node, including:
[0103] Step 1031: Send the return value to the server, and the server is used to determine the modification strategy corresponding to the target node according to the return value.
[0104] Step 1032: Receive the modification strategy determined by the server according to the returned value.
[0105] That is to say, after completing the node detection of the target page, the native App client needs to send the return value of the target node that needs to be modified to the server, so that the server can determine the modification strategy for each target node. This can effectively reduce the data processing volume of the native App client. Moreover, based on the computing power of the server, it can effectively enrich the strategy for modifying the target node, without the native App client having to store a large number of modification strategies, thereby ensuring the timeliness of the modification of the target node.
[0106] Specifically, after using the template function to obtain the return value corresponding to the Dom node, the return value that is not empty is sent to the server. The server obtains the modification policy corresponding to the return value based on the information recorded in the return value and based on the stored preset rules, and returns the modification policy to the client. Among them, when the modification policy is deletion, the server only returns the modification instruction of deletion. When the modification policy is replacement, the server returns the modification instruction of replacement and the node data information after replacement, so that the client can replace the node according to the received node data information after replacement when loading the target page.
[0107] In one or more embodiments, communication with a server is performed based on a native interface, and before sending the return value to the server, the process also includes: converting the return value to a data type corresponding to the native interface to obtain an intermediate return value; performing function encoding on the intermediate return value to obtain a string corresponding to the return value; and sending the string to the server, which determines a modification strategy corresponding to the target node based on the string.
[0108] Among them, the correspondence between JavaScript data types and Native interface data types is as follows
[0109]
[0110]
[0111] That is to say, the return value can be directly converted to the data corresponding to the native interface according to the data type of the return value in the JavaScript language and the mapping relationship between the JavaScript data type and the native data type to obtain the intermediate return value.
[0112] Optionally, when the return value does not define a JavaScript data type, for example, when directly returning the data content of the target node itself, the returned data also needs to be classified. Specifically, a method or classification can be added to the data. If the data matches the type provided by the added method or classification, the data is determined to be of that type. If it does not match, other methods or classification types are added again until the type to which the data belongs is determined. It should be understood that when adding methods or classifications, in order to save data processing, the Native data type can be directly added to the data.
[0113] Furthermore, after converting the return value into the data type corresponding to the native interface, the intermediate return value is further function-encoded to improve the security of the return value when it is sent to the server. Specifically, the return value can be converted into a 32-bit string using the f(x) function, and then the string is sent to the server. The server decodes the string to obtain a return value that can represent the data information of the target node and determines the modification policy corresponding to the target node based on the return value.
[0114] Therefore, this application uses the native interface to send the encoded string to the server, effectively ensuring the security and reliability of the return value sending.
[0115] In one or more embodiments, the modification strategy includes replacement and deletion. When the modification strategy is deletion, the target page is modified based on the modification strategy to obtain a modified target page, including: obtaining the target distance between the target node and the previous node, and modifying the distance between the subsequent node of the target node and the previous node to the target distance.
[0116] That is to say, when the target node needs to be deleted, the distance between the two nodes before and after the node is actually reduced. For example, when in the node sequence A, B, and C, the distance between A and B is a, the distance between B and C is b, and the distance between A and C is a+b. Then, when B is the target node and the corresponding modification strategy is deletion, the distance between A and C can be modified to a.
[0117] It should be understood that when the modification policy corresponding to the target node is modification, the receiving server returns data information for replacing the target node, and when rendering the target page, the replaced data information can be directly executed.
[0118] As a specific embodiment, Figure 5 As shown, the page information display method of this embodiment includes the following steps:
[0119] Step 201: Start the native App client.
[0120] Step 202: Initialize H5 handle.
[0121] Step 203: Receive and save the internal link and template function sent by the server.
[0122] Step 204: Receive the target page.
[0123] Among them, the target page is an H5 page, and the target page is obtained by triggering operations such as loading, refreshing, redirecting and jumping.
[0124] Step 205: Determine whether the URL of the target page matches the internal link.
[0125] If it matches, the H5 page is loaded; if it does not match, step 206 is executed.
[0126] Step 206: Initialize the JSContext object and pass the search function to the template function.
[0127] Step 207: traverse the Dom nodes in the target page using the template function.
[0128] Step 208: Get the return value of executing the template function.
[0129] Step 209: Determine whether the return value is empty.
[0130] If yes, then load the H5 page; if no, execute step 210.
[0131] Step 210: Send the return value to the server.
[0132] Step 211: Receive the modification policy returned by the server.
[0133] Step 212, load the H5 page.
[0134] To sum up, when the present application receives a loading request for the target page and determines the external page of the target page, it parses the nodes in the target page based on preset rules to obtain the target node that needs to be modified, and then modifies the target node in the target page, so that when there is unfavorable information in the target page, only the unfavorable information can be modified, thereby retaining the partial integrity of the target page and avoiding the entire page from being blocked from loading.
[0135] It should be noted that although the operations of the present method are described in a particular order in the drawings, this does not require or imply that the operations must be performed in this particular order, or that all illustrated operations must be performed to achieve desirable results.
[0136] Figure 6 A block diagram of another device for displaying page information proposed in this embodiment of the present application. Figure 6 As shown, the page information display device 10 includes:
[0137] The receiving module 11 is configured to, upon receiving a target page loading request, identify whether the target page's resources satisfy a preset condition;
[0138] The parsing module 12 is used to parse each node in the target page based on preset rules to obtain the return value corresponding to each node;
[0139] The determination module 13 is used to determine the target node that needs to be modified in the target page according to the return value corresponding to the node, and obtain the modification strategy corresponding to the target node according to the return value corresponding to the target node;
[0140] The loading module 14 is configured to modify the target page based on the modification strategy to obtain a modified target page, and display the modified target page.
[0141] In some embodiments, the receiving module 11 is further configured to:
[0142] Extract the resource locator from the load request;
[0143] When the resource locator does not match the internal resource list, it is determined that the target page meets the preset condition.
[0144] In some embodiments, the parsing module 12 is further configured to:
[0145] Input the nodes in the target page one by one into the corresponding template function, and the template function is used to return the situation where the node has unfavorable information;
[0146] According to whether the node has disadvantageous information, a return value corresponding to the node is obtained.
[0147] In some embodiments, the parsing module 12 is further configured to:
[0148] Get the target attribute of the root node;
[0149] According to the target attributes, obtain all nodes of the same type as the root node in the target page and generate a node dataset;
[0150] Input the node dataset into the template function corresponding to the target attribute.
[0151] In some embodiments, the determination module 13 is further configured to:
[0152] When it is identified that the type of the return value is not a preset type, a node corresponding to the return value is determined to be a target node, wherein the preset type is an object type with an empty value.
[0153] In some embodiments, the determination module 13 is further configured to:
[0154] The return value is sent to the server, which determines the modification strategy corresponding to the target node based on the return value;
[0155] The receiving server determines the modification policy based on the return value.
[0156] In some embodiments, the communication with the server is performed based on the native interface, and the determination module 13 is further configured to:
[0157] Convert the return value to the data type corresponding to the native interface to obtain the intermediate return value;
[0158] Perform function encoding on the intermediate return value to obtain a string corresponding to the return value;
[0159] The string is sent to the server, which determines the modification strategy corresponding to the target node based on the string.
[0160] In some embodiments, the modification strategy includes replacement and deletion. When the modification strategy is deletion, the loading module 14 is further configured to:
[0161] Get the target distance between the target node and the previous node;
[0162] Modify the distance between the node after the target node and the node before it to the target distance.
[0163] To sum up, when the present application receives a loading request for the target page and determines the external page of the target page, it parses the nodes in the target page based on preset rules to obtain the target node that needs to be modified, and then modifies the target node in the target page, so that when there is unfavorable information in the target page, only the unfavorable information can be modified, thereby retaining the partial integrity of the target page and avoiding the entire page from being blocked from loading.
[0164] It should be understood that the units or modules described in the page information modification device 10 are the same as those described in the reference Figure 2 The various steps in the described method correspond to each other. Therefore, the operations and features described above for the method are also applicable to the device for modifying page information 10 and the units contained therein, and will not be repeated here. The device for modifying page information 10 can be pre-implemented in the browser or other security applications of the electronic device, or can be loaded into the browser or its security application of the electronic device by downloading or other means. The corresponding units in the device for modifying page information 10 can cooperate with the units in the electronic device to implement the solution of the embodiment of the present application.
[0165] The several modules or units mentioned in the detailed description above are not necessarily divided into one module or unit. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0166] It should be noted that for details not disclosed in the page information modification device of the embodiment of the present application, please refer to the details disclosed in the above embodiments of the present application, and no further details will be given here.
[0167] Reference below Figure 7 , Figure 7 A schematic diagram of the structure of a computer system of an electronic device or server suitable for implementing the embodiments of the present application is shown.
[0168] like Figure 7 As shown, the computer system includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage part 708 into the random access memory (RAM) 703. Various programs and data required for the operation instructions of the system are also stored in the RAM 703. The CPU 701, ROM 702 and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0169] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, and the like; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 708 including a hard disk; and a communication section 709 including a network interface card such as a LAN card or a modem. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like, is installed in the drive 710 as needed, so that a computer program read therefrom can be installed into the storage section 708 as needed.
[0170] In particular, according to the embodiment of the present application, the above reference flow chart Figure 2 The described process can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709, and / or installed from a removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present application are executed.
[0171] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical cable, RF, or any suitable combination thereof.
[0172] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operating instructions of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the aforementioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than the order marked in the accompanying drawings. For example, the boxes represented by two connections can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operating instruction, or can be implemented using a combination of dedicated hardware and computer instructions.
[0173] The units or modules involved in the embodiments described in the present application can be implemented by software or by hardware. The units or modules described can also be set in a processor. For example, they can be described as: a processor includes a receiving module, a parsing module, a determination module and a loading module. Among them, the names of these units or modules do not constitute a limitation of the units or modules themselves under certain circumstances. For example, the receiving module can also be described as "upon receiving a loading request of a target page, identifying that the resources of the target page meet the preset conditions".
[0174] As another aspect, the present application further provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments, or may exist independently and not be incorporated into the electronic device. The computer-readable storage medium stores one or more programs, which, when used by one or more processors, execute the page information display method described in the present application.
[0175] The above description is merely a preferred embodiment of the present application and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but also encompasses other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the aforementioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A method for displaying page information, characterized in that: The method comprises: Upon receiving a request to load a target page, identifying whether resources of the target page satisfy a preset condition, wherein the preset condition is used to determine whether the target page is a page provided by a third party; Input each node in the target page into the function script corresponding to each node, query whether each node has unfavorable information based on the preset function rules of the function script, and obtain the return value corresponding to each node; wherein the return value corresponding to the node that does not contain unfavorable information is empty, and the return value corresponding to the node that contains unfavorable information includes the data information of the corresponding node; Determine the target node that needs to be modified in the target page according to the return value corresponding to each node in the target page, and obtain the modification strategy corresponding to the target node according to the data information included in the return value corresponding to the target node; The target page is modified based on the modification strategy to obtain a modified target page, and the modified target page is displayed.
2. The method according to claim 1, characterized in that The identifying that the resource of the target page meets a preset condition includes: Extracting the resource locator in the load request; When the resource locator does not match the internal resource list, it is determined that the target page meets a preset condition.
3. The method according to claim 1, characterized in that The target page includes a root node, and the corresponding relationship is a target attribute. Inputting each node in the target page into the function script corresponding to each node includes: Obtaining the target attribute of the root node; According to the target attribute, all nodes of the same type as the root node in the target page are obtained, and a node data set is generated; The node data set is input into a function script corresponding to the target attribute.
4. The method according to claim 1, wherein The return value includes a data type, and determining a target node that needs to be modified in a target page according to the return value corresponding to the node includes: When it is identified that the type of the return value is not a preset type, the node corresponding to the return value is determined to be the target node, wherein the preset type is an object type with an empty value.
5. The method according to claim 1, wherein The acquiring, according to the data information included in the return value corresponding to the target node, a modification strategy corresponding to the target node, includes: Sending the return value to a server, wherein the server is configured to determine a modification strategy corresponding to the target node according to the data information included in the return value; Receive the modification strategy determined by the server according to the data information included in the return value.
6. The method according to claim 5, characterized in that Communicating with the server based on a native interface, and before sending the return value to the server, further comprising: Convert the return value to the data type corresponding to the native interface to obtain an intermediate return value; Performing function encoding on the intermediate return value to obtain a character string corresponding to the return value; The character string is sent to the server, and the server is configured to determine a modification policy corresponding to the target node based on the character string.
7. The method according to claim 1, characterized in that The modification strategy includes replacement and deletion. When the modification strategy is deletion, modifying the target page based on the modification strategy to obtain a modified target page includes: Obtaining a target distance between the target node and the previous node; The distance between the node following the target node and the node preceding the target node is modified to the target distance.
8. A device for displaying page information, characterized in that: The device comprises: A receiving module, configured to, upon receiving a load request for a target page, identify whether resources of the target page satisfy a preset condition, wherein the preset condition is used to determine whether the target page is a page provided by a third party; a parsing module, configured to input each node in the target page into a function script corresponding to each node, query each node based on a preset function rule of the function script to determine whether it has unfavorable information, and obtain a return value corresponding to each node; wherein the return value corresponding to a node that does not contain unfavorable information is empty, and the return value corresponding to a node that contains unfavorable information includes data information of the corresponding node; a determination module, configured to determine a target node in the target page that needs to be modified based on the return value corresponding to each node in the target page, and to obtain a modification strategy corresponding to the target node based on data information included in the return value corresponding to the target node; The loading module is used to modify the target page based on the modification strategy to obtain a modified target page, and display the modified target page.
9. The device according to claim 8, characterized in that The receiving module is used to: Extracting the resource locator in the load request; When the resource locator does not match the internal resource list, it is determined that the target page meets a preset condition.
10. The device according to claim 8, characterized in that The target page includes a root node, and the corresponding relationship is a target attribute. The determination module is further used to: Obtaining the target attribute of the root node; According to the target attribute, all nodes of the same type as the root node in the target page are obtained, and a node data set is generated; The node data set is input into a function script corresponding to the target attribute.
11. The device according to claim 8, characterized in that The return value includes a data type, and the determination module is further configured to: When it is identified that the type of the return value is not a preset type, the node corresponding to the return value is determined to be the target node, wherein the preset type is an object type with an empty value.
12. The device according to claim 8, characterized in that The determining module is further configured to: Sending the return value to a server, wherein the server is configured to determine a modification strategy corresponding to the target node according to the data information included in the return value; Receive the modification strategy determined by the server according to the data information included in the return value.
13. The device according to claim 12, characterized in that Communicating with the server based on a native interface, the determining module is further configured to: Convert the return value to the data type corresponding to the native interface to obtain an intermediate return value; Performing function encoding on the intermediate return value to obtain a character string corresponding to the return value; The character string is sent to the server, and the server is configured to determine a modification policy corresponding to the target node based on the character string.
14. The device according to claim 8, characterized in that The modification strategy includes replacement and deletion. When the modification strategy is deletion, the loading module is further used to: Obtaining a target distance between the target node and the previous node; The distance between the node following the target node and the node preceding the target node is modified to the target distance.
15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for displaying page information according to any one of claims 1 to 7 is implemented.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for displaying page information as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Hybrid application-based loading method and apparatus
CN107491320A
Page processing method and device, electronic equipment and computer readable medium
CN111353112A