Page rearrangement method and computing device
By injecting a reflow script into reading applications to remove invalid information and add useful information, the problem of cluttered book information modules was solved, improving user experience and the effectiveness of information display.
Patent Information
- Application Number
- CN202111274094.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2041-10-29
Smart Images

Figure CN114021044B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of mobile application, in particular to a page rearrangement method and a computing device. BACKGROUND
[0002] A reading application is an APP dedicated to providing high-quality reading services. For a reading application, in addition to providing book reading services for users, how to provide information for users to decide which book to read is also an important link. In order to solve this problem, some reading applications provide a book information module, which aims to improve the service link for helping users make decisions on which book to read.
[0003] However, the book information of the book information module comes from the relatively uncontrollable outside, such as some external book promotion texts or videos, etc. The introduction of uncontrollable external content will make the book information display in the reading APP chaotic, and the page is filled with advertisements, backflow entrances, UGC and other content, which affects users to obtain key recommended book information in the information source, distracts users' attention, and is not conducive to users to make reading decisions. SUMMARY
[0004] In view of the above problems, the present application is proposed in order to provide a page rearrangement method, a computing device and a computer storage medium which overcome the above problems or at least partially solve the above problems.
[0005] According to one aspect of the present application, a page rearrangement method is provided, comprising:
[0006] triggering loading of a source page according to a page access request;
[0007] injecting a rearrangement script, running the rearrangement script to find a first target page element in a DOM file of the source page, and deleting the first target page element;
[0008] rearranging the source page according to the processed DOM file to obtain a target page;
[0009] presenting the target page.
[0010] According to another aspect of the present application, a computing device is provided, comprising a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface completing communication with each other through the communication bus;
[0011] The memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform the following operations:
[0012] triggering loading of a source page according to a page access request;
[0013] injecting a rearrangement script, running the rearrangement script to find a first target page element in a DOM file of the source page, and deleting the first target page element;
[0014] rearranging the source page according to the processed DOM file to obtain a target page;
[0015] presenting the target page.
[0016] According to another aspect of the present application, a computer storage medium is provided, and the computer storage medium stores at least one executable instruction, and the executable instruction causes a processor to perform operations corresponding to the above page rearrangement method.
[0017] According to the scheme provided by the embodiments of the present application, after a user initiates a page access request for an external source page in an application program, loading of the source page is triggered, a rearrangement script is injected, and the rearrangement script is run to delete irrelevant interference information in the source page, so that the target page retains effective information beneficial to decision-making of the user and no longer contains invalid information such as advertisements, backflow entrances, UGC, etc., interference of the invalid information is excluded, the user is facilitated to make decisions, and user experience is effectively improved.
[0018] The above description is only a summary of the technical scheme of the present application, in order to more clearly understand the technical means of the present application, the content of the specification can be implemented, and in order to make the above and other purposes, characteristics and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application are described below. BRIEF DESCRIPTION OF DRAWINGS
[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of the preferred embodiments and are not meant to limit the present application. Furthermore, the same reference numerals are used throughout the several drawings to refer to same or like parts. In the drawings:
[0020] Figure 1 a flowchart of a page rearrangement method according to one embodiment of the present application is shown;
[0021] Figure 2 a flowchart of a page rearrangement method according to another embodiment of the present application is shown;
[0022] Figure 3 a flowchart of a page rearrangement method according to still another embodiment of the present application is shown;
[0023] Figure 4 a structural diagram of a computing device according to one embodiment of the present application is shown. DETAILED DESCRIPTION
[0024] Exemplary embodiments of the present application will be described herein below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it is understood that the present application can be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the application to those skilled in the art.
[0025] Figure 1 A flowchart of a page rearrangement method according to an embodiment of the present application is shown. The method is applicable to a scheme in which an application rearranges a source page derived from an external source to obtain a target page and presents the target page. The execution subject of the method can be a client corresponding to the application. As shown in Figure 1 the method includes the following steps:
[0026] Step 101: Trigger loading of a source page according to a page access request.
[0027] After a user initiates a page access request for an external source page in an application, loading of the source page is triggered. Specifically, according to an access link of the source page, a page file of the source page is downloaded. The page file includes a DOM file and a resource file.
[0028] Taking a book review module of a reading application as an example, after a user enters the book review module, the user is interested in some book review information in the book review module and clicks a link of the corresponding book review information, thereby initiating a page access request for a source page derived from an external source corresponding to the book review information and triggering loading of the source page.
[0029] Step 102: Inject a rearrangement script, run the rearrangement script to find a first target page element in a DOM file of the source page, and perform deletion processing on the first target page element.
[0030] In this embodiment, in order to clean up interference information in the source page, a rearrangement script is created in advance. After the client triggers loading of the source page, the rearrangement script is injected. Optionally, the injection timing of the rearrangement script is before page presentation, that is, the rearrangement processing on the source page is completed before page presentation, so as to clean up the disorganized source page and facilitate the user of the application to obtain effective information conducive to decision-making of the user.
[0031] The rearrangement script is run to find a first target page element in a DOM file of the source page, and the first target page element is subjected to deletion processing. The first target page element is specifically a page element of invalid information. The invalid information specifically refers to information that has no guiding effect on decision-making of the user, such as advertising information, a backflow entrance, a UGC feedback entrance such as a comment / forward / like, and other irrelevant recommendation information, and the like.
[0032] Step 103, rearranging the source page according to the processed DOM file to obtain the target page.
[0033] The processed DOM file in this step refers to the DOM file after the above deletion processing. The source page is rearranged according to the processed DOM file. Since the processed DOM file has deleted the first target page element, the target page obtained by rearrangement no longer contains the first target page element.
[0034] Step 104, presenting the target page.
[0035] The above-mentioned embodiments of the present application provide a scheme. After a user initiates a page access request for an external source page in an application, the loading of the source page is triggered, a rearrangement script is injected, and the rearrangement script is run to delete irrelevant interference information in the source page. The target page retains effective information for the user to make a decision and no longer contains invalid information such as advertisements, backflow entrances, UGC, etc. The interference of invalid information is excluded, the user is facilitated to make a decision, and the user experience is effectively improved.
[0036] Figure 2 A flowchart of a page rearrangement method according to another embodiment of the present application is shown. As shown in the figure, the method comprises the following steps: Figure 2
[0037] Step 201, analyzing the DOM file and the resource file of the source page to obtain an analysis result, and creating a rearrangement script according to the analysis result.
[0038] The execution subject of this step can be a server or other special-purpose equipment (for example, a terminal device specially used by a research and development personnel). Taking a book information module as an example, before a link of a certain external book information is put online on the book information module, the page file of the corresponding source page is first downloaded according to the access link of the book information. The page file contains a DOM file and a resource file. Then, the DOM file and the resource file of the source page are analyzed to obtain an analysis result, and a rearrangement script is created according to the analysis result. After the creation of the rearrangement script is completed, the server feeds back the rearrangement script to the client, so that the client can rearrange the source page when accessing the source page.
[0039] Specifically, the step can include: analyzing the DOM file of the source page to obtain a first analysis result; the first analysis result containing element features of a first target page element in the DOM file of the source page; and creating a rearrangement script according to the first analysis result. Specifically, the DOM structure of the source page is analyzed by using a browser, element features of each page element of the source page are obtained, a page element with invalid information, for example, a page element with an advertising feature, a page element with a backflow entry feature, a page element with a UGC feedback entry feature, and some page elements with a recommendation feature, is found according to the element features, the page element with invalid information is taken as the first target page element, and the rearrangement script is created, so that the rearrangement script has a script function of deleting the first target page element.
[0040] Further, the step can further include: analyzing a resource file of the source page to obtain a second analysis result; and determining a second target page element to be added according to the second analysis result, and creating a rearrangement script. In this embodiment, on the basis of excluding the interference of invalid information, the rearrangement script is used to add the second target page element that can help a user understand valid information in the target page. The second target page element can be obtained by analyzing the resource file of the page. Taking book information as an example, the source page of the book information contains page resources such as text and video, and the second target page element is generated by analyzing the title, the picture, and / or the video to extract valid information to be added.
[0041] For example, the source page of a certain book information contains a book promotion video, and the book promotion video introduces multiple books. In this embodiment, the book names of the multiple books can be parsed by performing voice analysis and / or video image analysis on the video resource, and for each book, a book name label element is generated as the second target page element to be added. Similarly, for the picture resource contained in the source page, image analysis can be performed to parse the corresponding book label and generate the second target page element; for the audio resource contained in the source page, voice analysis can be performed to parse the corresponding book label and generate the second target page element; and for the text resource (such as a title and a brief introduction) contained in the source page, text analysis can be performed to parse the corresponding book label and generate the second target page element.
[0042] Step 202: loading of the source page is triggered according to a page access request.
[0043] In this embodiment, the execution subject of steps 202 to 206 is a client corresponding to an application. Specifically, the container for loading a web page in the client is used for execution. In the following, Android WebView of an Android system is taken as an example for introduction, but the embodiments of the present application are not limited to application in the Android system.
[0044] After the user initiates a page access request for the external source page in the application, the loading of the source page is triggered. Specifically, according to the access link of the source page, the page file of the source page is downloaded. The page file includes a DOM file and a resource file.
[0045] Taking a book information module of a reading application as an example, after the user enters the book information module, the user is interested in some book information in the book information module, clicks the link of the corresponding book information, and thus initiates a page access request for the source page from the outside corresponding to the book information, triggering the loading of the source page.
[0046] In step 203, it is determined whether the source page is loaded. If yes, step 204 is performed; otherwise, the waiting continues.
[0047] It is determined whether the source page is loaded. If the source page is loaded, the WebView has complete page elements, and the rearrangement script is injected at this time in this embodiment. If the source page is not loaded, the waiting continues until the source page is loaded.
[0048] In step 204, the rearrangement script is injected, the page delay presentation condition is set, the rearrangement script is run to find the first target page element in the DOM file of the source page, the first target page element is deleted, and the second target page element is added in the DOM file of the source page.
[0049] After the source page is loaded, the rearrangement script is injected through the AndroidWebView. According to the description of step 201, the rearrangement script has the functions of deleting the first target page element in the page and adding the second target page element in the page. The rearrangement script is run to find the first target page element in the DOM file of the source page, and the first target page element is deleted. The first target page element is specifically a page element of invalid information, and the invalid information specifically refers to information that has no guiding effect on the user's decision, such as advertising information, backflow entrances, UGC feedback entrances such as comments, forwarding, and likes, and other irrelevant recommendation information. At the same time, the rearrangement script is also run to add the second target page element in the page. The second target page element is specifically a tag element obtained by analyzing the resource file of the page. Taking books as an example, the second target page element is specifically various book name tags, author tags, book key person tags, and the like. By adding the second target page element in the page, the user can understand the effective information. The user clicks the second target page element to trigger the search of information corresponding to the tag element in the application, and the effective information is enhanced.
[0050] Further, since the present embodiment injects the rearrangement script after the source page is loaded, the running of the rearrangement script requires a certain amount of time, but in the existing process, the source page is presented immediately after being loaded. Therefore, the problem of first flashing the disordered page before rearrangement and then refreshing the page after rearrangement occurs. In order to avoid this problem of page flashing, the present embodiment further sets a page delay presentation condition after injecting the rearrangement script, that is, the page is presented after a preset time interval. The preset time interval can be 200 ms, and the present application does not limit this.
[0051] Step 205, rearranging the source page according to the processed DOM file to obtain a target page.
[0052] The processed DOM file in the present step refers to the DOM file after the above-mentioned deletion and addition processing, and the source page is rearranged according to the processed DOM file. Since the processed DOM file has deleted the first target page element, the target page obtained by rearrangement no longer contains the first target page element; the processed DOM file has added the second target page element, so the target page obtained by rearrangement contains the second target page element.
[0053] Step 206, presenting the target page when the page delay presentation condition is met.
[0054] According to the page delay presentation condition set in step 204, it is judged whether the time interval of the delay presentation is greater than or equal to the preset time interval. If yes, the page delay presentation condition is met, and the target page is presented.
[0055] In an optional embodiment, for the case that the target page contains a video element, the present step further comprises: obtaining the length information and the width information of the video element through the rearrangement script; in response to the full-screen playing instruction, determining the full-screen playing mode of the video element according to the length information and the width information of the video element, the full-screen playing mode being a horizontal screen playing mode or a vertical screen playing mode; presenting the target page according to the full-screen playing mode of the video element. In the present embodiment, the rearrangement script has the function of flexibly adjusting the full-screen playing mode of the video element according to the length and width information of the video element, and after monitoring the full-screen playing instruction, the video is played in the corresponding full-screen playing mode in response to the full-screen playing instruction.
[0056] The solution provided by the above embodiments of the present invention loads the source page after a user initiates a page access request to an external source page within the application. After the source page is loaded, a reflow script is injected and run. This script removes irrelevant and distracting information from the source page and adds more relevant and useful information that the user needs. This ensures the target page retains useful information that helps the user make decisions, eliminating invalid information such as advertisements, re-entry points, and UGC. By eliminating the interference of invalid information, the display of useful information and its traffic-driving effect are enhanced, effectively improving the user experience. Furthermore, after injecting the reflow script, page delay rendering conditions are set to avoid page flickering issues, optimizing the page display effect.
[0057] Figure 3 A flowchart illustrating a page reflow method according to yet another embodiment of the present invention is shown. Figure 3 As shown, the method includes the following steps:
[0058] Step 301: Analyze the DOM files and resource files of the source page to obtain the analysis results, and create a reflow script based on the analysis results.
[0059] Step 302: Based on the page access request, trigger the loading of the source page.
[0060] The specific implementation methods of steps 301 and 302 can be found in the description of steps 201 and 202 in the above embodiment, and will not be repeated here.
[0061] Step 303: Based on the loading progress of the source page, determine whether the injection conditions for the reordering script are met. If yes, proceed to step 304; otherwise, after the loading progress of the source page is updated, proceed to step 303 again.
[0062] exist Figure 2 In the illustrated embodiment, if the reflow script is injected only after the source page has finished loading, the source page contains many static resources (such as images, audio, or video), which require a long loading time. This results in a longer loading time for the entire page, negatively impacting the user experience. To further optimize the user experience, this embodiment initiates the injection of the reflow script when the source page has reached a certain loading progress. Since the reflow script modifies the DOM file of the source page, its success depends on whether the DOM file has finished loading. However, AndroidWebView cannot determine when the DOM file has finished loading. Therefore, this embodiment pre-sets a progress threshold, such as 30%, and determines whether the loading progress of the source page is greater than or equal to this threshold. If so, the injection conditions for the reflow script are met, and the injection of the reflow script is initiated.
[0063] Step 304, inject and run the rearrangement script.
[0064] Step 305, determine whether the rearrangement script runs successfully, if yes, execute step 306; if no, execute step 304 after the loading progress of the source page is updated.
[0065] The function of the rearrangement script is to modify the DOM file of the source page. If the DOM file has not been loaded completely, the page elements in the DOM file are not complete, which may cause the rearrangement script to fail to run. Specifically, the rearrangement script is run to find the first target page element in the DOM file of the source page. If any first target page element fails to be found, it is determined that the rearrangement script fails to run. If the rearrangement script fails to run, the rearrangement script is re-injected and run after the loading progress of the source page is updated.
[0066] Further, when the rearrangement script is run, it can first determine whether the first target page element to be deleted in the DOM file is loaded completely. If the first target page element to be deleted is not found, the addition and deletion processing is not performed, and a result of failure to run is output. With the update of the loading progress, if the first target page element to be deleted in the DOM file is found to be loaded completely, the addition and deletion processing is performed, and a result of success to run is output. The rearrangement script can inform the client of the result of success to run through the JSBridge. At this time, the client stops the action of injecting the rearrangement script with the update of the loading progress, and hides the loading frame.
[0067] By using the method provided in the embodiment, it is verified through experiments that the rearrangement script runs successfully when the loading progress of the source page is about 50%. Since the rearrangement script is not injected after the source page is loaded completely, the source page does not flicker, and thus the page delay presentation condition does not need to be set, so that the loading speed of the page is further improved.
[0068] Step 306, rearrange the source page according to the processed DOM file to obtain a target page.
[0069] The processed DOM file in this step refers to the DOM file after the deletion processing and the addition processing. The source page is rearranged according to the processed DOM file. Since the first target page element is deleted from the processed DOM file, the target page obtained by rearranging does not contain the first target page element. The second target page element is added to the processed DOM file, and thus the target page obtained by rearranging contains the second target page element.
[0070] Step 307, present the target page.
[0071] Further, in the case that the target page contains a video element, the step includes: obtaining length information and width information of the video element by the rearrangement script; in response to the full-screen playing instruction, determining a full-screen playing mode of the video element according to the length information and the width information of the video element, the full-screen playing mode being a horizontal screen playing mode or a vertical screen playing mode; and presenting the target page according to the full-screen playing mode of the video element.
[0072] The scheme provided by the above embodiments of the present application can, after a user initiates a page access request for an external source page in an application program, load the source page, continuously attempt to inject a rearrangement script after the source page is loaded to a certain progress, and stop the attempt to inject after the rearrangement script is successfully run. By using the method, irrelevant interference information in the source page is deleted, and effective information required by the user is added, so that the target page retains effective information beneficial to the user to make a decision, and no longer contains invalid information such as advertisements, backflow entrances, UGC, etc. The interference of invalid information is excluded, the display and diversion of effective information are enhanced, and the user experience is effectively improved. In addition, the present embodiment does not need to set a page delay presentation condition, and simultaneously avoids the problem of page flashing, optimizes the page display effect, and improves the page loading speed.
[0073] The embodiments of the present application also provide a nonvolatile computer storage medium, which stores at least one executable instruction, and the computer executable instruction can execute the page rearrangement method in any method embodiment described above.
[0074] The executable instruction can be specifically used to make the processor perform the following operations:
[0075] According to the page access request, triggering loading of the source page;
[0076] Injecting a rearrangement script, running the rearrangement script to find a first target page element in a DOM file of the source page, and performing deletion processing on the first target page element;
[0077] According to the processed DOM file, rearranging the source page to obtain a target page;
[0078] Presenting the target page.
[0079] In an optional implementation, the executable instruction also makes the processor perform the following operation:
[0080] Running the rearrangement script to add a second target page element in the DOM file of the source page.
[0081] In an optional implementation, the executable instruction also makes the processor perform the following operation:
[0082] determining whether the injection condition of the rearrangement script is satisfied according to the loading progress of the source page;
[0083] injecting the rearrangement script after determining that the injection condition of the rearrangement script is satisfied.
[0084] In an optional implementation, the executable instructions further cause the processor to perform the following operation:
[0085] determining whether the source page is loaded completely, and if yes, determining that the injection condition of the rearrangement script is satisfied.
[0086] In an optional implementation, the executable instructions further cause the processor to perform the following operation:
[0087] setting a page delay presentation condition;
[0088] presenting the target page when the page delay presentation condition is satisfied.
[0089] In an optional implementation, the executable instructions further cause the processor to perform the following operation:
[0090] determining whether the loading progress of the source page is greater than or equal to a preset progress threshold, and if yes, determining that the injection condition of the rearrangement script is satisfied.
[0091] In an optional implementation, the executable instructions further cause the processor to perform the following operation:
[0092] determining whether the rearrangement script runs successfully, and if not, re-injecting the rearrangement script after the loading progress of the source page is updated; repeating the present step until the rearrangement script runs successfully.
[0093] In an optional implementation, the executable instructions further cause the processor to perform the following operation:
[0094] analyzing the DOM file of the source page to obtain a first analysis result; the first analysis result comprises element features of a first target page element in the DOM file of the source page;
[0095] creating the rearrangement script according to the first analysis result.
[0096] In an optional implementation, the executable instructions further cause the processor to perform the following operation:
[0097] analyzing the resource file of the source page to obtain a second analysis result;
[0098] determining a second target page element that needs to be added according to the second analysis result, and creating the rearrangement script.
[0099] In an alternative embodiment, the target page contains a video element, and the executable instructions further cause the processor to perform the following operations:
[0100] obtain length information and width information of the video element by rearranging the script;
[0101] in response to a full-screen playing instruction, determine a full-screen playing mode of the video element according to the length information and the width information of the video element, the full-screen playing mode being a horizontal screen playing mode or a vertical screen playing mode;
[0102] present the target page according to the full-screen playing mode of the video element.
[0103] Figure 4 A structural diagram of a computing device according to an embodiment of the present application is shown, and embodiments of the present application do not limit the specific implementation of the computing device.
[0104] As shown in Figure 4 the computing device can include a processor 402, a communications interface 404, a memory 406, and a communications bus 408.
[0105] The processor 402, the communications interface 404, and the memory 406 can communicate with each other through the communications bus 408.
[0106] The communications interface 404 is configured to communicate with network elements such as clients or other servers.
[0107] The processor 402 is configured to execute a program 410, and can perform the related steps in the above-described page rearrangement method embodiments.
[0108] Specifically, the program 410 can include program code including computer operation instructions.
[0109] The processor 402 can be a central processing unit CPU, or an application specific integrated circuit ASIC, or one or more integrated circuits configured to implement embodiments of the present application. The one or more processors included in the computing device can be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0110] a memory 406, storing a program 410. The memory 406 can include a high-speed RAM memory and can also include a non-volatile memory, such as at least one disk memory.
[0111] The program 410 can specifically be configured to cause the processor 402 to perform the following operations:
[0112] trigger loading of a source page according to a page access request;
[0113] inject a rearrangement script, and run the rearrangement script to find a first target page element in a DOM file of the source page, and delete the first target page element;
[0114] rearrange the source page according to the processed DOM file to obtain a target page;
[0115] present the target page.
[0116] In an optional implementation, the program 410 can specifically be configured to cause the processor 402 to perform the following operations:
[0117] run the rearrangement script to add a second target page element in the DOM file of the source page.
[0118] In an optional implementation, the program 410 can specifically be configured to cause the processor 402 to perform the following operations:
[0119] determine whether an injection condition of the rearrangement script is met according to a loading progress of the source page;
[0120] inject the rearrangement script after determining that the injection condition of the rearrangement script is met.
[0121] In an optional implementation, the program 410 can specifically be configured to cause the processor 402 to perform the following operations:
[0122] determine whether the source page is loaded completely, and if yes, determine that the injection condition of the rearrangement script is met.
[0123] In an optional implementation, the program 410 can specifically be configured to cause the processor 402 to perform the following operations:
[0124] set a page delay presentation condition;
[0125] present the target page when the page delay presentation condition is met.
[0126] In an optional implementation, the program 410 can specifically be configured to cause the processor 402 to perform the following operations:
[0127] determining whether the loading progress of the source page is greater than or equal to a preset progress threshold, and if yes, determining that the injection condition of the rearrangement script is met.
[0128] In an optional implementation, the program 410 can be specifically configured to cause the processor 402 to perform the following operations:
[0129] determining whether the rearrangement script runs successfully, and if not, re-injecting the rearrangement script after the loading progress of the source page is updated; and repeating the present step until the rearrangement script runs successfully.
[0130] In an optional implementation, the program 410 can be specifically configured to cause the processor 402 to perform the following operations:
[0131] analyzing the DOM file of the source page to obtain a first analysis result; the first analysis result comprises element characteristics of a first target page element in the DOM file of the source page;
[0132] creating a rearrangement script according to the first analysis result.
[0133] In an optional implementation, the program 410 can be specifically configured to cause the processor 402 to perform the following operations:
[0134] analyzing the resource file of the source page to obtain a second analysis result;
[0135] creating a rearrangement script according to the second analysis result and determining a second target page element that needs to be added.
[0136] In an optional implementation, the target page comprises a video element, and the program 410 can be specifically configured to cause the processor 402 to perform the following operations:
[0137] obtaining length information and width information of the video element through the rearrangement script;
[0138] in response to a full-screen playing instruction, determining a full-screen playing mode of the video element according to the length information and the width information of the video element, the full-screen playing mode being a horizontal screen playing mode or a vertical screen playing mode;
[0139] presenting the target page according to the full-screen playing mode of the video element.
[0140] The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems can be used with programs in accordance with the teachings herein, or it can prove convenient to construct more specialized apparatus to perform the required method steps. The required structure for a variety of these systems will be apparent from the description above. In addition, the present embodiments are not described with reference to any particular programming language. It will be appreciated that a variety of programming languages can be used to implement the teachings of the application as described herein, and any references below to specific languages are provided for disclosure of enablement only.
[0141] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to avoid obscuring the understanding of this description.
[0142] Similarly, it is to be understood that the mechanical details of the application that have been set forth in the description above of exemplary embodiments of the application are intended to be illustrative only. As such, the scope of the application is not to be construed as being limited to such specific embodiments. Rather, various modifications of the embodiments, in addition to those described herein, will be discernible to one skilled in the art, and the general principles defined herein can be applied to any of the em bodiments and equivalents thereof. Therefore, the present application is to be accorded the most broad scope that can be contemplated under the pertinently-applicable statutes.
[0143] Those skilled in the art will appreciate that the modules in the apparatuses in the embodiments can be adapted and placed in one or more apparatuses other than the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and further can be divided into more sub-modules or sub-units or sub-components. Any combination of all the features disclosed in the specification (including the accompanying claims, abstract and drawings), and any method or apparatus so disclosed, can be made unless specifically stated otherwise. Each feature disclosed in the specification (including the accompanying claims, abstract and drawings) can be replaced by alternative features serving the same, equivalent or similar purpose unless specifically stated otherwise.
[0144] Furthermore, those skilled in the art will recognize that, while certain embodiments described herein include certain features that are not included in other embodiments, combinations of features of the different embodiments are meant to be within the scope of the application and form different embodiments. For example, in the claims below, any of the claimed embodiments can be used in any combination.
[0145] Various component embodiments of the application can be implemented in hardware, or as software modules running in one or more processors, or in combinations thereof. Those skilled in the art will appreciate that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functionality of some or all of the components according to embodiments of the application. The application can also be implemented as a program of instructions for performing part or all of the methods described herein, e.g., a computer program and a computer program product. Such program of the application can be stored on a computer readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, or provided on a carrier medium, or in any other form.
[0146] It is noted that the foregoing examples have been provided merely for the purpose of explanation and are in no way to be construed as limiting of the present application. While the application has been described with reference to preferred embodiments, it is understood that the words which have been used herein are words of description, and that changes can be made within the scope and spirit of the application. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word comprising does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the system claims enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not imply any order. These words have been used to name the elements and their sequence does not have any significance. The steps of any of the methods disclosed herein do not have to be performed in the order disclosed, unless otherwise specified.
Claims
1. A page reflow method, the method comprising: Based on the page access request, the loading of the source page is triggered; Determine whether the loading progress of the source page is greater than or equal to a preset progress threshold. If so, determine that the injection conditions for the reordering script are met. After determining that the injection conditions for the reflow script are met, the reflow script is injected and run to find the first target page element in the DOM file of the source page and delete the first target page element. If the search for any first target page element fails, the reflow script is considered to have failed. If the reflow script fails, the injection and run of the reflow script are retried after the loading progress of the source page is updated. When the reflow script runs, it first checks whether the first target page element to be deleted in the DOM file has been loaded. If it cannot be found, no addition or deletion is performed, and the result of failure is output. Based on the processed DOM file, the source page is rearranged to obtain the target page; The target page is then displayed.
2. The method according to claim 1, further comprising, after injecting the rearrangement script: Run the reflow script to add a second target page element to the DOM file of the source page.
3. The method according to claim 1, further comprising, after injecting the rearrangement script: Set page delay rendering conditions; The presentation of the target page specifically means: when the page delay presentation condition is met, the target page is presented.
4. The method according to claim 1, further comprising, after injecting the rearrangement script: Determine whether the reordering script ran successfully. If not, re-inject the reordering script after the loading progress of the source page is updated. Repeat this step until the rearrangement script runs successfully.
5. The method according to claim 1, wherein before triggering the loading of the source page according to the page access request, the method further comprises: The DOM file of the source page is analyzed to obtain the first analysis result; The first analysis result includes the element characteristics of the first target page element in the DOM file of the source page; Create a rearrangement script based on the results of the first analysis.
6. The method according to claim 2, wherein before triggering the loading of the source page based on the page access request, the method further comprises: The resource files of the source page are analyzed to obtain the second analysis result; Based on the second analysis result, determine the second target page element that needs to be added and create a reflow script.
7. The method according to claim 1, wherein the target page includes video elements, and presenting the target page further includes: The length and width information of the video element are obtained through the reflow script; In response to a full-screen playback command, the full-screen playback mode of the video element is determined based on the length and width information of the video element. The full-screen playback mode is either a landscape playback mode or a portrait playback mode. The target page is presented according to the full-screen playback mode of the video element.
8. A computing device, comprising: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction, which causes the processor to perform the following operations: Based on the page access request, the loading of the source page is triggered; Determine whether the loading progress of the source page is greater than or equal to a preset progress threshold. If so, determine that the injection conditions for the reordering script are met. After determining that the injection conditions for the reflow script are met, the reflow script is injected and run to find the first target page element in the DOM file of the source page and delete the first target page element. If the search for any first target page element fails, the reflow script is considered to have failed. If the reflow script fails, the injection and run of the reflow script are retried after the loading progress of the source page is updated. When the reflow script runs, it first checks whether the first target page element to be deleted in the DOM file has been loaded. If it cannot be found, no addition or deletion is performed, and the result of failure is output. Based on the processed DOM file, the source page is rearranged to obtain the target page; The target page is then displayed.
9. The computing device of claim 8, wherein the executable instructions cause the processor to perform the following operations: Run the reflow script to add a second target page element to the DOM file of the source page.
10. The computing device of claim 8, wherein the executable instructions cause the processor to perform the following operation: setting page delay rendering conditions; When the page delay rendering condition is met, the target page is rendered.
11. The computing device of claim 8, wherein the executable instructions cause the processor to perform the following operations: Determine whether the reordering script ran successfully. If not, re-inject the reordering script after the loading progress of the source page is updated. Repeat this step until the reordering script runs successfully.
12. The computing device of claim 8, wherein the executable instructions cause the processor to perform the following operations: Analyze the DOM file of the source page to obtain a first analysis result; the first analysis result includes the element characteristics of the first target page element in the DOM file of the source page; Create a rearrangement script based on the results of the first analysis.
13. The computing device of claim 9, wherein the executable instructions cause the processor to perform the following operations: The resource files of the source page are analyzed to obtain the second analysis result; Based on the second analysis result, determine the second target page element that needs to be added and create a reflow script.
14. The computing device of claim 8, wherein the executable instructions cause the processor to perform the following operations: When the target page contains video elements, the length and width information of the video elements are obtained through the reflow script; In response to a full-screen playback command, the full-screen playback mode of the video element is determined based on the length and width information of the video element. The full-screen playback mode is either a landscape playback mode or a portrait playback mode. The target page is presented according to the full-screen playback mode of the video element.
15. A computer storage medium storing at least one executable instruction that causes a processor to perform an operation corresponding to the page reordering method as described in any one of claims 1-7.
Citation Information
Patent Citations
A web page transcoding method based on browser kernel
CN109284459A
Optimization for browser rendering during navigation
US20170357383A1