Method for loading page data, device for loading page data, and electronic device
By obtaining and loading the page data required by the web view control before the target application jumps, the problems of slow web page loading speed of the WebView control and excessive APP size are solved, the loading speed is improved and the traffic consumption is reduced.
Patent Information
- Application Number
- CN202110730141.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-29
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2041-06-29
AI Technical Summary
When using the WebView control to load web pages in an app, it takes a long time to download web page data, resulting in slow web page loading speed and affecting the user experience. In addition, a large number of CSS and JS files cause the app to be too large and increase traffic consumption.
Before the target application jumps to the lower-level page, the page data link required by the web view control is obtained in advance, and the data is directly loaded when jumping to avoid downloading the data after the jump.
It improves page loading speed, avoids the problem of APP being too large, and reduces traffic consumption.
Smart Images

Figure CN113568674B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network technology, and in particular to a method for loading page data, a device for loading page data, and an electronic device. Background Art
[0002] The WebView (web view) control is a very common control in apps (applications). Its main function is to respond and interact with the front-end page, quickly and efficiently implementing expected functions. It is equivalent to an enhanced version of the built-in browser. Specifically, apps can directly load web pages through the WebView control.
[0003] When using the WebView control to load a web page in an APP, you need to first use the WebView control to download the web page data, and then load the web page by loading the downloaded web page data. The web page data here is usually CSS (Cascading Style Sheets) files and JS (JavaScript) files. In this process, since it takes a long time to download the web page data, the web page loading speed is too slow, which greatly affects the user experience. To solve the above problems, it is usually adopted to pre-build CSS files and JS files in the APP, which directly avoids the process of downloading CSS files and JS files.
[0004] However, as the business volume involved in the APP increases, a large number of CSS files and JS files will appear. How to manage these files to ensure the normal operation of the APP has become a problem. At the same time, the large number of CSS files and JS files also makes the APP too large, requiring more traffic to download or update the APP. Summary of the Invention
[0005] In view of the above problems, embodiments of the present invention are proposed to provide a method for loading page data, an apparatus for loading page data, and an electronic device that overcome the above problems or at least partially solve the above problems.
[0006] In a first aspect, an embodiment of the present invention provides a method for loading page data, the method comprising:
[0007] When the target application loads the target page, obtaining a page data link of at least one subordinate page, wherein the subordinate page is a page to which the target application jumps after the user performs a first operation on the target page, and the subordinate page is provided with a web page view control;
[0008] According to the page data link, acquiring target page data of each subordinate page, wherein the target page data includes data required to be loaded by the webpage view control;
[0009] When the target application jumps from the target page to a target subordinate page, target page data of the target subordinate page is loaded into a web page view control of the target subordinate page, wherein the target subordinate page is one of the at least one subordinate page.
[0010] Optionally, when the target application loads the target page, obtaining a page data link of at least one subordinate page includes:
[0011] When the target application loads the target page, obtaining a target parameter of the target page, wherein the target parameter indicates a page identifier including the target page;
[0012] Sending the target parameter to a target server, so that the target server determines, based on the received target parameter, a page data link of at least one of the subordinate pages corresponding to the target parameter;
[0013] Receive a page data link of at least one of the subordinate pages sent by the target server.
[0014] Optionally, the target parameters also include: a page identifier of a parent page, wherein the parent page is the previous page to which the target application jumps to the target page; the page data links determined by the target server based on the page identifier of the same target page and the page identifiers of different parent pages are not exactly the same.
[0015] Optionally, the target parameters further include: control parameters for indicating user operations, wherein the page data links determined by the target server according to the page identifier of the same target page and different control parameters are not completely the same.
[0016] Optionally, acquiring the target page data of each subordinate page according to the page data link includes:
[0017] Select an idle web view control from the pre-created web view cache pool;
[0018] Download the target page data indicated by each page data link through the idle web view control;
[0019] Before the target application jumps from the target page to the target lower-level page, loading of the target page data is prohibited.
[0020] Optionally, a preset number of initialized web view controls are stored in the web view cache pool.
[0021] In a second aspect, an embodiment of the present invention further provides a device for loading page data, the device comprising:
[0022] A first acquisition module is configured to acquire, when a target application loads a target page, a page data link of at least one subordinate page, wherein the subordinate page is a page to which the target application jumps after a user performs a first operation on the target page, and the subordinate page is provided with a web page view control;
[0023] A second acquisition module is configured to acquire target page data of each subordinate page according to the page data link, wherein the target page data includes data required to be loaded by the webpage view control;
[0024] A loading module is used to load the target page data of the target subordinate page into the web page view control of the target subordinate page when the target application jumps from the target page to the target subordinate page, wherein the target subordinate page is one of the at least one subordinate page.
[0025] Optionally, the first acquisition module includes:
[0026] an acquiring unit, configured to acquire target parameters of a target page when a target application loads the target page, wherein the target parameter indicates a page identifier of the target page;
[0027] a sending unit, configured to send the target parameter to a target server, so that the target server determines, based on the received target parameter, a page data link of at least one of the subordinate pages corresponding to the target parameter;
[0028] The receiving unit is configured to receive a page data link of at least one of the subordinate pages sent by the target server.
[0029] Optionally, the target parameters also include: a page identifier of a parent page, wherein the parent page is the previous page to which the target application jumps to the target page; the page data links determined by the target server based on the page identifier of the same target page and the page identifiers of different parent pages are not exactly the same.
[0030] Optionally, the target parameters further include: control parameters for indicating user operations, wherein the page data links determined by the target server according to the page identifier of the same target page and different control parameters are not completely the same.
[0031] Optionally, the second acquisition module includes:
[0032] A selection unit, configured to select an idle web view control from a pre-created web view cache pool;
[0033] A downloading unit, configured to download target page data indicated by each page data link through an idle web view control;
[0034] The prohibition unit is used to prohibit the loading of the target page data before the target application jumps from the target page to the target lower-level page.
[0035] Optionally, a preset number of initialized web view controls are stored in the web view cache pool.
[0036] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0037] Memory for storing computer programs;
[0038] The processor is used to implement the steps of the above-mentioned method for loading page data when executing the program stored in the memory.
[0039] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the method for loading page data as described in the first aspect.
[0040] In an embodiment of the present invention, when a target application loads a target page, it obtains a page data link for at least one subordinate page. The subordinate page is the page to which the target application redirects after a user performs a first operation on the target page, and the subordinate page is provided with a web view control. By obtaining the page data link, the target application prepares to load the page data indicated by the page data link after redirecting to the subordinate page. Based on the page data link, target page data for each subordinate page is obtained, where the target page data includes data required to be loaded by the web view control. Before the target application redirects to the subordinate page, the data required to be loaded by the web view control in the subordinate page, namely, the target page data, is pre-obtained. When the target application redirects from the target page to a target subordinate page, the target page data for the target subordinate page is loaded into the web view control of the target subordinate page, where the target subordinate page is one of the at least one subordinate page. This embodiment of the present invention avoids the process of downloading the target page data based on the page data link after the target application redirects to the subordinate page, thereby improving page loading speed. It also avoids the problem of excessive application size caused by the large number of built-in CSS and JS files. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0042] Figure 1 A flowchart of the steps of a method for loading page data provided by an embodiment of the present invention;
[0043] Figure 2 A flowchart of the actual application of the method for loading page data provided by an embodiment of the present invention;
[0044] Figure 3 A structural block diagram of a device for loading page data provided by an embodiment of the present invention;
[0045] Figure 4 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0047] It should be understood that references throughout this specification to "one embodiment" or "an embodiment" mean that a particular feature, structure, or characteristic associated with the embodiment is included in at least one embodiment of the present invention. Therefore, the appearances of "in one embodiment" or "in an embodiment" throughout this specification do not necessarily refer to the same embodiment. Furthermore, these particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0048] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0049] See also Figure 1 , an embodiment of the present invention provides a method for loading page data, which may include:
[0050] Step 101: When a target application loads a target page, obtain a page data link of at least one subordinate page.
[0051] In this step, the target application can be any application installed on an electronic device, such as shopping, work, and leisure and entertainment applications installed on a smartphone. The target page can be any page in the target application, for example, the target page can be the homepage of the target application, but is not limited to this. The subordinate page is the page to which the target application jumps after the user performs a first operation on the target page, and the subordinate page is provided with a web view control. Here, the first operation can be an operation such as clicking, sliding, and long pressing. When the user performs the first operation on the target page, the control on the target page will be triggered, causing the target application to jump to a page. If the page to which the jump is provided is provided with a web view control, the page to which the jump is provided can be considered a subordinate page. For example, the target page can be a list page in the target application, which includes information on multiple items. By clicking on the information of an item, the user causes the target application to jump to the item's details page. If the details page is provided with a web view control, the details page is considered a subordinate page.
[0052] Each subordinate page corresponds to a page data link, which is a network link to the page data that the subordinate page needs to load. Specifically, the page data link is a URL (Uniform Resource Locator) pointing to the page data.
[0053] Step 102: Obtain target page data of each subordinate page according to the page data link.
[0054] In this step, the target page data includes the data required to be loaded by the web view control. Here, the data required to be loaded by the web view control includes at least CSS files and JS files. The page data pointed to by the page data link includes at least the target page data. For example, a corresponding URL is set for a certain subordinate page, and the URL points to the CSS file and JS file to be loaded by the web view control in the subordinate page. Therefore, the CSS file and JS file to be loaded by the web view control in the subordinate page can be downloaded according to the URL. Of course, the data required to be loaded by the web view control can also include HTML (Hypertext Markup Language) files.
[0055] Step 103: When the target application jumps from the target page to the target subordinate page, the target page data of the target subordinate page is loaded into the webpage view control of the target subordinate page.
[0056] In this step, after the user performs the first operation on the target page, the target application jumps from the target page to the target subordinate page. The target page can have one or more subordinate pages. If there are multiple subordinate pages of the target page, each subordinate page corresponds to its own target page data. When jumping to the target subordinate page, the target page data corresponding to the target subordinate page is loaded through the web view control of the target subordinate page.
[0057] In an embodiment of the present invention, when a target application loads a target page, a page data link for at least one subordinate page is obtained. The subordinate page is the page to which the target application redirects after a user performs a first operation on the target page, and the subordinate page is provided with a web view control. By obtaining the page data link, preparations are made for loading the page data indicated by the page data link after the target application redirects to the subordinate page. Target page data for each subordinate page is obtained based on the page data link, where the target page data includes data required to be loaded by the web view control. Before the target application redirects to the subordinate page, the data required to be loaded by the web view control in the subordinate page, namely, the target page data, is pre-obtained. When the target application redirects from the target page to a target subordinate page, the target page data for the target subordinate page is loaded into the web view control of the target subordinate page, where the target subordinate page is one of the at least one subordinate page. This embodiment of the present invention avoids the process of downloading the target page data based on the page data link after the target application redirects to the subordinate page, thereby improving page loading speed. It also avoids the problem of excessive application size caused by the large number of built-in CSS and JS files.
[0058] Optionally, when the target application loads the target page, obtaining a page data link of at least one subordinate page includes:
[0059] When the target application loads the target page, target parameters of the target page are acquired, wherein the target parameters at least include a page identifier of the target page.
[0060] It should be noted that each page in the target application has a unique page identifier. In other words, a page identifier can be used to identify a unique page in the target application. The page identifier can be a page attribute of the target page, and the page identifier can be obtained by obtaining the corresponding page attribute. Here, the page identifier can be a unique identifier composed of any one or more combinations of numbers, letters, and special symbols.
[0061] The target parameter is sent to the target server, so that the target server determines the page data link of at least one subordinate page corresponding to the target parameter according to the received target parameter.
[0062] It should be noted that the target server can receive information sent by an electronic device installed with the target application. Preferably, the target server is the backend server corresponding to the target application. The target server pre-stores multiple sets of target parameters, each set of target parameters corresponding to at least one page data link. Preferably, all page data links corresponding to the same set of target parameters are stored in the same list; that is, each set of target parameters corresponds to a list storing all page data links corresponding to that set of target parameters. It is understandable that since the target application has been developed, the relationships between the various pages in the target application and the page status of each page can be easily understood. The page status includes information such as the page identifier, the controls used by each page, and the data to be loaded. Based on this information, the correspondence between target parameters and page data links is pre-set on the target server. For example, the homepage in the target application has a page identifier of aa, and the subordinate pages of the homepage include a first page with a page identifier of bb and a second page with a page identifier of cc. The page data link for the target page data required to be loaded by the web view control in the first page is mm. The page data link for the target page data required to be loaded by the web view control in the second page is nn. One of the target parameters set on the target server is aa, and the corresponding relationships between aa and mm and nn are set respectively.
[0063] Receive at least one page data link of a subordinate page sent by the target server.
[0064] It should be noted that the target server sends the page data links of all subordinate pages corresponding to the target parameters to the target application.
[0065] In an embodiment of the present invention, the target server stores the page data link of each subordinate page corresponding to the target page in advance. With the help of the page identifier of the target page, the page data link of the subordinate page is obtained from the target server, which can avoid the need to embed the page data link of each subordinate page in the target application.
[0066] Optionally, the target parameters also include: the page identifier of the parent page, wherein the parent page is the page before the target application jumps to the target page; the page data links determined by the target server based on the page identifier of the same target page and the page identifiers of different parent pages are not exactly the same.
[0067] It should be noted that different pages in the target application can jump to the same page. Due to different jump paths, that is, different pages before jumping to the same page, the controls and data loaded by the same page are not exactly the same. At this time, the same page that loads different controls and different data will correspond to different subordinate pages. That is, the page data links corresponding to the first target parameter and the second target parameter in the target server are not exactly the same. The first target parameter and the second target parameter include the page identifier of the same target page and the page identifiers of different upper-level pages. In other words, each group of target parameters on the target server includes a page identifier combination consisting of two page identifiers, one of which is the page identifier of the target page, and the other is the page identifier of the upper-level page before jumping to the target page. Moreover, the page identifier combinations in different groups of target parameters are not exactly the same. After receiving the target parameters, the target server determines the page data link of at least one lower-level page based on the page identifier combination therein.
[0068] For example, if the page identifier of the target page is aa, the first page with the page identifier bb in the target application can directly jump to the target page, and the second page with the page identifier cc can also directly jump to the target page, then the first page and the second page are both parent pages of the target page. If the page identifiers included in the target parameters are aa and bb, it means that the target application jumps from the first page to the target page. At this time, the page data link of the subordinate page corresponding to the target parameter is mm, where mm represents multiple different page data links. If the page identifiers included in the target parameters are aa and cc, it means that the target application jumps from the second page to the target page. At this time, the page data link of the subordinate page corresponding to the target parameter is nn, where nn represents multiple different page data links. Here, the page data links represented by mm and nn are not exactly the same.
[0069] In an embodiment of the present invention, the target parameter includes the page ID of the previous page in the target application that jumps to the target page and the page ID of the target page, and the page ID of the previous page is taken into account as the jump path. Determining the page data link of the lower-level page based on the jump path can better meet actual needs.
[0070] Optionally, the target parameters further include: a control parameter for indicating a user operation, wherein the page data links determined by the target server according to the page identifier of the same target page and different control parameters are not completely the same.
[0071] It should be noted that the control parameter indicating the user operation is the parameter of the control triggered when the user operates on the target page, which may at least include a control identifier. Each control on the target page has a unique control identifier, and the corresponding control can be determined by the control parameter.
[0072] It is understandable that when the user performs certain operations on the target page, it will not cause the target application to jump to a page, but will change the controls and data currently displayed on the target page. At this time, the subordinate page corresponding to the current target page may change. Therefore, in order to accurately obtain the subordinate page corresponding to the current state of the target page, the page identifier and control parameters of the target page are used as target parameters, and the page data link of the corresponding subordinate page is obtained from the target server. Here, it is necessary to set the page data link of the corresponding subordinate page in advance in the target server for different target parameters based on the relationship between the pages in the target application.
[0073] For example, the target page is a lottery page with a lottery function. When the page is just jumped to, the target page corresponds to several subordinate pages. When the user triggers the lottery function of the lottery page, information and controls showing the winning results will be added to the lottery page. If the user wins the prize, the additional displayed controls will include a prize collection control for the prize collection function. By triggering the prize collection control, the user will cause the target application to jump from the lottery page to the prize collection page. The prize collection page here is a subordinate page corresponding to the lottery page after the user triggers the lottery function. It should be noted that when the user does not trigger the lottery function of the lottery page, it is impossible to jump from the lottery page to the prize collection page. Therefore, the prize collection page is not included in the subordinate pages corresponding to the lottery page at this time. In other words, the prize collection page is a subordinate page newly added after the user operates on the lottery page. Based on the above scenario, the page data link of the subordinate page corresponding to the first target parameter pre-set in the target server does not include the page data link of the award page, and the page data link of the subordinate page corresponding to the second target parameter includes the page data link of the award page. The first target parameter and the second target parameter include the same page identifier and different control parameters.
[0074] In an embodiment of the present invention, the target parameters include a control parameter for indicating a user operation and a page identifier of a target page. The target pages after different user operations are used as target pages in different states. Determining the page data link of the subordinate page based on the target pages in different states can better meet actual needs.
[0075] Optionally, according to the page data link, the target page data of each subordinate page is obtained, including:
[0076] Select an idle web view control from the pre-created web view cache pool.
[0077] It should be noted that the web view cache pool stores a preset number of initialized web view controls. Specifically, a cache pool is created, and a preset number of web view controls are created in the cache pool to initialize the web view controls. The number of web view controls can be one or more. Here, the working state of the web view control includes an idle state and a non-idle state. Specifically, while the web view control is downloading page data according to the page data link, the working state of the web view control is continuously in a non-idle state. The working state of the web view control when it is not in use is an idle state.
[0078] Download the target page data indicated by each page data link through the idle web view control.
[0079] It should be noted that the working state of the web view controls in the web view cache pool will change over time. While a web view control is downloading the target page data indicated by a page data link, its working state is non-idle. After the download is complete, the web view control's working state transitions to idle. At this point, if the target page data indicated by a page data link remains undownloaded, the idle web view control is used to download the target page data for that page data link. Preferably, an HTML page template can be pre-created, and after selecting an idle web view control, the HTML page template can be used to load the page data to download the target page data indicated by each page data link.
[0080] It is understandable that the target page data indicated by all page data links need to be downloaded. The downloaded target page data can be stored in a cache of the electronic device installed with the target application, but is not limited thereto.
[0081] Before the target application jumps from the target page to the target lower-level page, loading the target page data is prohibited.
[0082] It should be noted that before the target application jumps from the target page to the target lower-level page, it is necessary to prevent the target page from loading the downloaded data. For example, by using the preload tag in the HTML page template, only the target page data can be downloaded without immediately loading the downloaded data. This means that the page logic will not be triggered, the page will not be rendered, and there will be no performance loss.
[0083] In the embodiment of the present invention, a web view cache pool storing web view controls is pre-created, and target page data is downloaded based on initialized web view controls in the view cache pool, which can further improve the loading speed of the target subordinate page.
[0084] like Figure 2FIG. 1 is a flowchart of a practical application of a method for loading page data provided by an embodiment of the present invention, including:
[0085] Step 201: Open a target page in a target application; the target page may be any page in the target application, such as a home page, a list page, a details page, etc.
[0086] Step 202: Start the preload service and request a preload list from the server with the corresponding parameters. Here, the parameters for requesting the preload list are the target parameters in the above-mentioned embodiment of the invention. The preload list contains a page data link of at least one subordinate page corresponding to the target parameter. To avoid repetition, we will not repeat them here.
[0087] Step 203: Start the WebView cache pool service, take out the initialized and idle WebView control from the WebView cache pool, and use the taken out WebView control to download the CSS file and JS file according to the page data link in the preload list, that is, the target page data in the above-mentioned invention embodiment. In the case where the target application jumps from the target page to any lower-level page, the lower-level page to be jumped to is taken as the target lower-level page for explanation, and the downloaded CSS file and JS file of the corresponding target lower-level page are loaded into the WebView control of the target lower-level page. Of course, since the HTML file is relatively small, you can choose to download the HTML file when jumping to the target lower-level page. When the WebView control loads the CSS file and JS file, it also loads the HTML file at the same time.
[0088] The embodiment of the present invention avoids the process of downloading target page data according to the page data link after the target application jumps to the lower-level page, thereby improving the page loading speed; at the same time, it also avoids the problem of the application being too large due to the built-in large number of CSS files and JS files.
[0089] The above describes the method for loading page data provided by the embodiment of the present invention. The following describes the device for loading page data provided by the embodiment of the present invention with reference to the accompanying drawings.
[0090] See also Figure 3 , an embodiment of the present invention further provides a device for loading page data, the device comprising:
[0091] A first acquisition module 31 is configured to acquire, when the target application loads the target page, a page data link of at least one subordinate page, wherein the subordinate page is the page to which the target application redirects after the user performs a first operation on the target page, and the subordinate page is provided with a web page view control;
[0092] The second acquisition module 32 is used to acquire target page data of each subordinate page according to the page data link, wherein the target page data includes data required to be loaded by the web view control;
[0093] The loading module 33 is configured to load target page data of a target subordinate page into a webpage view control of the target subordinate page when the target application jumps from the target page to the target subordinate page, wherein the target subordinate page is one of at least one subordinate page.
[0094] Optionally, the first acquisition module 31 includes:
[0095] an acquiring unit, configured to acquire target parameters of a target page when a target application loads the target page, wherein the target parameter indication includes a page identifier of the target page;
[0096] a sending unit, configured to send the target parameter to the target server, so that the target server determines, based on the received target parameter, a page data link of at least one subordinate page corresponding to the target parameter;
[0097] The receiving unit is configured to receive a page data link of at least one subordinate page sent by a target server.
[0098] Optionally, the target parameters also include: the page identifier of the parent page, wherein the parent page is the page before the target application jumps to the target page; the page data links determined by the target server based on the page identifier of the same target page and the page identifiers of different parent pages are not exactly the same.
[0099] Optionally, the target parameters further include: a control parameter for indicating a user operation, wherein the page data links determined by the target server according to the page identifier of the same target page and different control parameters are not completely the same.
[0100] Optionally, the second acquisition module 32 includes:
[0101] A selection unit, configured to select an idle web view control from a pre-created web view cache pool;
[0102] A downloading unit, configured to download target page data indicated by each page data link through an idle web view control;
[0103] The prohibition unit is used to prohibit the loading of target page data before the target application jumps from the target page to the target lower-level page.
[0104] Optionally, a preset number of initialized web view controls are stored in the web view cache pool.
[0105] The device for loading page data provided by the embodiment of the present invention can realize Figures 1 to 2 To avoid repetition, the various processes of the method for loading page data in the method embodiment are not described here.
[0106] In an embodiment of the present invention, when a target application loads a target page, a page data link for at least one subordinate page is obtained. The subordinate page is the page to which the target application redirects after a user performs a first operation on the target page, and the subordinate page is provided with a web view control. By obtaining the page data link, preparations are made for loading the page data indicated by the page data link after the target application redirects to the subordinate page. Target page data for each subordinate page is obtained based on the page data link, where the target page data includes data required to be loaded by the web view control. Before the target application redirects to the subordinate page, the data required to be loaded by the web view control in the subordinate page, namely, the target page data, is pre-obtained. When the target application redirects from the target page to a target subordinate page, the target page data for the target subordinate page is loaded into the web view control of the target subordinate page, where the target subordinate page is one of the at least one subordinate page. This embodiment of the present invention avoids the process of downloading the target page data based on the page data link after the target application redirects to the subordinate page, thereby improving page loading speed. It also avoids the problem of excessive application size caused by the large number of built-in CSS and JS files.
[0107] On the other hand, an embodiment of the present invention further provides an electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0108] Memory for storing computer programs;
[0109] The processor is used to implement the steps of the above-mentioned method for loading page data when executing the program stored in the memory.
[0110] Here is an example: Figure 4 A schematic diagram of the physical structure of an electronic device is shown.
[0111] like Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other via the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the following method:
[0112] When the target application loads the target page, obtaining a page data link of at least one subordinate page, wherein the subordinate page is a page to which the target application jumps after the user performs a first operation on the target page, and the subordinate page is provided with a web page view control;
[0113] According to the page data link, the target page data of each subordinate page is obtained, wherein the target page data includes the data required to be loaded by the web view control;
[0114] When the target application jumps from the target page to the target subordinate page, the target page data of the target subordinate page is loaded into the webpage view control of the target subordinate page, wherein the target subordinate page is one of the at least one subordinate page.
[0115] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0116] In another aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for loading page data provided in the above embodiments is implemented, for example, including:
[0117] When the target application loads the target page, obtaining a page data link of at least one subordinate page, wherein the subordinate page is a page to which the target application jumps after the user performs a first operation on the target page, and the subordinate page is provided with a web page view control;
[0118] According to the page data link, the target page data of each subordinate page is obtained, wherein the target page data includes the data required to be loaded by the web view control;
[0119] When the target application jumps from the target page to the target subordinate page, the target page data of the target subordinate page is loaded into the webpage view control of the target subordinate page, wherein the target subordinate page is one of the at least one subordinate page.
[0120] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0121] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0122] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for loading page data, characterized in that: The method comprises: When the target application loads the target page, obtaining a page data link of at least one subordinate page, wherein the subordinate page is a page to which the target application jumps after the user performs a first operation on the target page, and the subordinate page is provided with a web page view control; According to the page data link, acquiring target page data of each of the subordinate pages, wherein the target page data includes data required to be loaded by the webpage view control; When the target application jumps from the target page to a target subordinate page, loading target page data of the target subordinate page into a webpage view control of the target subordinate page, wherein the target subordinate page is one of the at least one subordinate page; Wherein, obtaining the target page data of each subordinate page according to the page data link includes: Select an idle web view control from the pre-created web view cache pool; Download the target page data indicated by each page data link through the idle web view control; Before the target application jumps from the target page to the target lower-level page, loading of the target page data is prohibited.
2. The method according to claim 1, characterized in that The step of obtaining a page data link of at least one subordinate page when the target application loads the target page includes: When the target application loads the target page, obtaining target parameters of the target page, wherein the target parameters at least include a page identifier of the target page; Sending the target parameter to a target server, so that the target server determines, based on the received target parameter, a page data link of at least one of the subordinate pages corresponding to the target parameter; Receive a page data link of at least one of the subordinate pages sent by the target server.
3. The method according to claim 2, characterized in that The target parameters also include: a page identifier of a parent page, wherein the parent page is the page before the target application jumps to the target page; the page data links determined by the target server based on the page identifiers of the same target page and the page identifiers of different parent pages are not exactly the same.
4. The method according to claim 2, characterized in that The target parameters also include: control parameters for indicating user operations, wherein the page data links determined by the target server according to the page identifier of the same target page and different control parameters are not completely the same.
5. The method according to claim 1, wherein The web page view cache pool stores a preset number of web page view controls that have completed initialization.
6. A device for loading page data, characterized in that: The device comprises: A first acquisition module is configured to acquire, when a target application loads a target page, a page data link of at least one subordinate page, wherein the subordinate page is a page to which the target application jumps after a user performs a first operation on the target page, and the subordinate page is provided with a web page view control; A second acquisition module is configured to acquire target page data of each subordinate page according to the page data link, wherein the target page data includes data required to be loaded by the webpage view control; a loading module, configured to load target page data of the target subordinate page into a web page view control of the target subordinate page when the target application jumps from the target page to a target subordinate page, wherein the target subordinate page is one of the at least one subordinate page; The second acquisition module includes: A selection unit, configured to select an idle web view control from a pre-created web view cache pool; A downloading unit, configured to download target page data indicated by each page data link through an idle web view control; The prohibition unit is used to prohibit the loading of the target page data before the target application jumps from the target page to the target lower-level page.
7. The device according to claim 6, characterized in that The first acquisition module includes: an acquiring unit, configured to acquire target parameters of the target page when the target application loads the target page, wherein the target parameters at least include a page identifier of the target page; a sending unit, configured to send the target parameter to a target server, so that the target server determines, based on the received target parameter, a page data link of at least one of the subordinate pages corresponding to the target parameter; The receiving unit is configured to receive a page data link of at least one of the subordinate pages sent by the target server.
8. The device according to claim 7, characterized in that The target parameters also include: a page identifier of a parent page, wherein the parent page is the page before the target application jumps to the target page; the page data links determined by the target server based on the page identifiers of the same target page and the page identifiers of different parent pages are not exactly the same.
9. The device according to claim 7, characterized in that The target parameters also include: control parameters for indicating user operations, wherein the page data links determined by the target server according to the page identifier of the same target page and different control parameters are not completely the same.
10. The device according to claim 6, characterized in that The web page view cache pool stores a preset number of web page view controls that have completed initialization.
11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; The processor is configured to implement the steps of the method for loading page data as described in any one of claims 1 to 5 when executing a program stored in the memory.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for loading page data according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Page loading method and device
CN111079048A
Webpage preloading method and device and computer equipment
CN112612982A