Page loading method and device, computer device, and storage medium
By managing the page lifecycle and business processing results within the application, the problem of low web page loading efficiency is solved, achieving efficient resource utilization and improved compatibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN PAY ELECTRONIC PAYMENT CO LTD
- Filing Date
- 2022-11-15
- Publication Date
- 2026-06-19
Smart Images

Figure CN115828006B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of page loading rendering, and in particular to a page loading method, apparatus, computer equipment, and computer storage medium. Background Technology
[0002] Direct navigation between web pages is a common service in application development. However, due to the inherent lifecycle characteristics of pages, it is impossible to accurately know the current processing flow of a page during loading. This requires requesting a large number of business results before selectively loading them, resulting in low page loading efficiency. In addition, the loading of some pages heavily depends on the application's native business logic. Adding or modifying native business logic can cause problems during page loading, making it impossible to load pages efficiently. Summary of the Invention
[0003] The purpose of this invention is to provide a page loading method, apparatus, computer device, and computer storage medium to at least solve the problems of resource waste and low efficiency in existing page loading.
[0004] To solve the above-mentioned technical problems, the present invention provides a page loading method, comprising:
[0005] Get the running status of the application;
[0006] When the running state is the foreground running state, the page management class of the application is obtained, and the page management class is used to store the business processing results of the second page;
[0007] In response to the application's rendering request for the first page, the number of times the first page has been loaded is obtained;
[0008] When the number of times the first page is loaded changes, the business processing result of the second page is obtained from the page management class;
[0009] The first page is loaded based on the rendering request of the first page and the business processing result of the second page.
[0010] Optionally, obtaining the number of times the first page is loaded includes:
[0011] Get the application's view controller and view controller properties;
[0012] Get the page identifier of the first page;
[0013] The pre-configured record parameters in the view controller properties are obtained based on the page identifier as the number of times the first page is loaded.
[0014] Optionally, after obtaining the number of loads of the first page in response to the application's rendering request for the first page, the method further includes:
[0015] When the number of loads of the first page does not change, obtain the target resource of the first page according to the rendering request of the first page;
[0016] The first page is loaded based on the target resource.
[0017] Optionally, after determining that the application is running in the foreground, the method further includes:
[0018] Activate the preset listener, which is used to monitor the page management class and the lifecycle of the page, including the number of times the page is loaded;
[0019] Activate the preset broadcast program, which is used to broadcast the page management class and the page lifecycle to the pages in the application.
[0020] Optionally, the method further includes:
[0021] When the application is running in the background or frozen state, the listening program and the broadcasting program are paused.
[0022] Optionally, after loading the first page based on the rendering request of the first page and the business processing result of the second page, the method further includes:
[0023] When the application leaves the first page, it retrieves the page resources of the first page;
[0024] Save the page resources to the application cache and configure the cache validity period of the page resources to a preset period.
[0025] Optionally, after saving the page resource to the application cache and configuring the cache validity period of the page resource to a preset period, the method further includes:
[0026] If an operation to enter the first page is received within the preset period, the page resources of the first page are retrieved from the application cache and then the first page is loaded.
[0027] If no operation to enter the first page is received from the application within the preset period, the page resources of the first page will be released from the application cache.
[0028] To address the aforementioned technical problems, embodiments of the present invention also provide a page loading device, comprising:
[0029] The runtime status module is used to obtain the runtime status of the application;
[0030] The business management module is used to obtain the page management class of the application when the running state is the foreground running state. The page management class is used to store the business processing results of the second page.
[0031] The rendering request module is used to respond to the application's rendering request for the first page and obtain the number of times the first page has been loaded.
[0032] The business acquisition module is used to obtain the business processing result of the second page from the page management class when the number of loads of the first page changes;
[0033] The rendering module is used to load the first page based on the rendering request of the first page and the business processing result of the second page.
[0034] Optionally, the rendering request module is further configured to:
[0035] Get the application's view controller and view controller properties;
[0036] Get the page identifier of the first page;
[0037] The pre-configured record parameters in the view controller properties are obtained based on the page identifier as the number of times the first page is loaded.
[0038] Optionally, the loading and rendering module is further configured to:
[0039] When the number of loads of the first page does not change, obtain the target resource of the first page according to the rendering request of the first page;
[0040] The first page is loaded based on the target resource.
[0041] Optionally, the operating status module is further used for;
[0042] Activate the preset listener, which is used to monitor the page management class and the lifecycle of the page, including the number of times the page is loaded;
[0043] Activate the preset broadcast program, which is used to broadcast the page management class and the page lifecycle to the pages in the application.
[0044] Optionally, the business management module is also used for;
[0045] When the application is running in the background or frozen state, the listening program and the broadcasting program are paused.
[0046] Optionally, the loading rendering module is also used for;
[0047] When the application leaves the first page, it retrieves the page resources of the first page;
[0048] Save the page resources to the application cache and configure the cache validity period of the page resources to a preset period.
[0049] The loading and rendering module is also used for:
[0050] If an operation to enter the first page is received within the preset period, the page resources of the first page are retrieved from the application cache and then the first page is loaded.
[0051] If no operation to enter the first page is received from the application within the preset period, the page resources of the first page will be released from the application cache.
[0052] Optionally, the application is a native application under the iOS system, and the native application contains an engine for loading web pages.
[0053] To address the aforementioned technical problems, this invention also provides a computer device, including a memory and a processor. The memory stores computer-readable instructions, which, when executed by the processor, cause the processor to perform the steps of the page loading method described above.
[0054] To address the aforementioned technical problems, this embodiment of the invention also provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the page loading method described above.
[0055] The beneficial effects of the embodiments of this invention are as follows: By obtaining the running state of the application and analyzing its current running state, when the running state is in the foreground running state, the application's page management class is obtained. The page management class is used to store the business processing results of the second page. If a rendering request for the first page is received at this time, in response to the application's rendering request for the first page, the loading count of the first page is obtained. The loading count of the first page is a parameter characterizing the life cycle of the first page, enabling the application to record the current business processing flow of the first page. When the loading count of the first page changes, the business processing results of the second page are obtained from the page management class, the resources of the first page are loaded according to the rendering request, and the business processing results of the second page are updated to the resources of the first page, completing the resource loading and page rendering of the first page at the current business process node. By configuring the page life cycle management mechanism in the application, the current business process of the page is perceived, the current processing flow of the Web page in the application is accurately located, and the current business of the page is accurately processed based on the process, reducing unnecessary business processing and interface requests, improving the rendering and loading efficiency of the page, and reducing compatibility issues between native applications and Web applications. Attached Figure Description
[0056] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0057] Figure 1 This is a basic flowchart illustrating a page loading method according to a specific embodiment of this application;
[0058] Figure 2 This is a schematic diagram of the basic structure of a page loading device according to a specific embodiment of this application;
[0059] Figure 3 This is a basic structural block diagram of a computer device according to a specific embodiment of this application. Detailed Implementation
[0060] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0061] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the word “comprising” as used in the specification of this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0062] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0063] Those skilled in the art will understand that the term "terminal" as used herein includes both devices that are wireless signal receivers, devices that are wireless signal receivers without transmitting capability, and devices with receiving and transmitting hardware, having receiving and transmitting hardware capable of performing bidirectional communication on a bidirectional communication link. Such devices may include: cellular or other communication devices having a single-line display, a multi-line display, or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service) that can combine voice, data processing, fax, and / or data communication capabilities; PDA (Personal Digital Assistant) that may include a radio frequency receiver, pager, Internet / intranet access, web browser, notepad, calendar, and / or GPS (Global Positioning System) receiver; and conventional laptop and / or handheld computers or other devices that have and / or include a radio frequency receiver. As used herein, "terminal" can be portable, transportable, installed in a means of transportation (air, sea, and / or land), or suitable and / or configured to operate locally, and / or in a distributed manner, operating in any other location on Earth and / or in space. "Terminal" as used herein can also be a communication terminal, an internet access terminal, or a music / video playback terminal, such as a PDA, a MID (Mobile Internet Device), and / or a mobile phone with music / video playback capabilities, or a smart TV, set-top box, etc.
[0064] The hardware referred to by the names "server," "client," and "service node" in this application is essentially an electronic device with the equivalent capabilities of a personal computer. It is a hardware device with the necessary components revealed by the von Neumann architecture, such as a central processing unit (including an arithmetic logic unit and a control unit), memory, input devices, and output devices. The computer program is stored in its memory, and the central processing unit loads the program stored in the secondary storage into the main memory to run it, execute the instructions in the program, and interact with the input and output devices to complete specific functions.
[0065] It should be noted that the concept of "server" used in this application can also be extended to the case of server clusters. Based on the network deployment principles understood by those skilled in the art, the servers should be logically divided. Physically, these servers can be independent of each other but accessible through interfaces, or they can be integrated into a single physical computer or a computer cluster. Those skilled in the art should understand this flexibility and should not use it to constrain the implementation of the network deployment method in this application.
[0066] One or more of the technical features of this application, unless explicitly specified herein, can be deployed on a server and accessed by a client remotely calling the online service interface provided by the server, or can be directly deployed and run on a client for access.
[0067] Unless otherwise specified, the neural network models referenced or potentially referenced in this application may be deployed on a remote server and invoked remotely on the client, or deployed on a client with the capability to invoke directly. In some embodiments, when running on the client, the corresponding intelligence may be acquired through transfer learning in order to reduce the requirements on the client's hardware resources and avoid excessive consumption of the client's hardware resources.
[0068] Unless otherwise specified, all data involved in this application may be stored remotely on a server or on a local terminal device, as long as it is suitable for use by the technical solution of this application.
[0069] Those skilled in the art will understand that although the various methods in this application are described based on the same concept and thus present commonality among them, they can be performed independently unless otherwise specified. Similarly, the various embodiments disclosed in this application are all based on the same inventive concept; therefore, concepts expressed in the same way, as well as concepts that are appropriately changed for convenience but are expressed differently, should be understood equivalently.
[0070] Unless otherwise expressly stated, the various embodiments disclosed in this application can be combined in a cross-cutting manner to flexibly construct new embodiments, as long as such combination does not depart from the inventive spirit of this application and can meet the needs of the prior art or solve a certain deficiency in the prior art. Those skilled in the art should be aware of such modifications.
[0071] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating the basic process of the page loading method in this embodiment.
[0072] like Figure 1 As shown, it includes:
[0073] S1100, Obtain the running status of the application;
[0074] In this embodiment, the application includes functions developed based on native application rules and functions developed based on web application rules. Functions developed based on native application rules can provide smooth, direct operation to the underlying hardware, while functions developed based on web application rules can quickly and conveniently deploy, add, delete, or modify various elements of the application. In the actual application development process, the cooperation between native application rules and web application rules improves the rapid development and smooth, efficient access of various functional pages in the application.
[0075] It should be noted that, in order to efficiently manage web pages in the application, ensuring efficient and low-resource loading of web pages and reducing development difficulty, this embodiment monitors the lifecycle of web pages and then effectively manages and configures their resources to improve the loading efficiency of web pages in the application. In one implementation, a page management system is configured in the application to accomplish the above functions, firstly by obtaining the application's running status.
[0076] It should be noted that the running status of the application can be set to be monitored in real time or monitored at a preset period. In one implementation, the running status parameters of the application are obtained. The running status parameters are used to indicate the current running status of the application, including running in the foreground, running in the background, and not running in the background.
[0077] In one application development scenario, the running status of an application is obtained by monitoring changes in the running status parameters. When the running status parameters change, the running status of the application can be detected, and then the running status of the application can be obtained.
[0078] S1200. When the running state is the foreground running state, obtain the page management class of the application, the page management class is used to store the business processing results of the second page;
[0079] After obtaining the application's running status, it is necessary to analyze the current running status of the application in order to accurately allocate and schedule resources based on the current running status of the application. When the running status is the foreground running status, the application's page management class is obtained. The page management class is used to store the business processing results of the second page.
[0080] It should be noted that the application can load and open any web page. For better description of this embodiment, the two different web pages are defined as the first page and the second page.
[0081] It should be noted that a page management class is created in the application to manage the business processing results of any web page, including receiving and storing the business processing results of any web page, including receiving and storing the business processing results of a second page.
[0082] It should be noted that when the application is determined to be running in the foreground, the application's page management class is obtained so that the business processing results of each web page can be obtained from the page management class.
[0083] S1300: In response to the application's rendering request for the first page, obtain the number of times the first page has been loaded;
[0084] After determining that the application is running in the foreground, if a rendering request for the first page is received at this time, the system responds to the application's rendering request for the first page and obtains the number of times the first page has been loaded.
[0085] It should be noted that the rendering request for the first page can be triggered by opening a new first page. For example, when a user opens the application, the application is running in the foreground. The user can enter the URL of the first page in the application to request to open the first page or request to open the first page through a preset shortcut tab, which triggers the rendering request for the first page.
[0086] It should be noted that the rendering request for the first page can be triggered by navigating to an existing page. For example, when a user opens the application, the application is running in the foreground. The user has already opened the first page in the application, navigates to the second page through the first page, and then navigates back to the first page from the second page. This triggers a rendering request for the first page.
[0087] It should be noted that the load count of the first page is a parameter representing the lifecycle of the first page, enabling the application to record the current business process of the first page. Optionally, when the lifecycle of the first page is in its initial stage, the load count of the first page is 0, and the load count of the first page is incremented by 1 each time the first page is loaded and displayed; alternatively, when the lifecycle of the first page is in its initial stage, the load count of the first page is 0, and the rendering request of the first page can be triggered by jumping to an existing page, the load count of the first page is incremented by 1.
[0088] S1400: When the number of times the first page is loaded changes, obtain the business processing result of the second page from the page management class;
[0089] In response to the application's rendering request for the first page, after obtaining the number of times the first page is loaded, when the number of times the first page is loaded changes, the business processing result of the second page is obtained from the page management class.
[0090] It should be noted that changes in the load count of the first page can be identified through the following method: obtain the current load count of the first page, obtain the previous load count of the first page, and determine that the load count of the first page has changed when the current load count is different from the previous load count. When the load count changes, it can be sensed that the loading and rendering of the first page needs to be changed based on the business processing results of other pages. At this time, the business processing results of the second page are obtained from the page management class. The change in load count is triggered by a jump from the first page to the second page, and then a jump back to the first page from the second page.
[0091] It should be noted that the second page does not refer to a specific page, but rather to any web page associated with the first page, which is the page from which one is redirected to another web page, and from which one performs an operation.
[0092] S1500: Load the first page according to the rendering request of the first page and the business processing result of the second page.
[0093] After obtaining the business processing result of the second page from the page management class, the first page is loaded according to the rendering request of the first page and the business processing result of the second page. The resources of the first page are loaded according to the rendering request, and the business processing result of the second page is updated to the resources of the first page, thus completing the resource loading and page rendering of the first page at the current business process node.
[0094] In the above embodiments, by obtaining the application's running status parameters, which indicate the application's current running status (including foreground running, background running, and background not running), the system analyzes the application's current running status. When the running status is foreground running, the system obtains the application's page management class, which stores the business processing results of the second page. If a rendering request for the first page is received at this time, in response to the application's rendering request for the first page, the system obtains the number of times the first page is loaded. The number of times the first page is loaded is a parameter characterizing the lifecycle of the first page, enabling the application to record the current business of the first page. The processing flow is as follows: when the number of loads of the first page changes, the business processing result of the second page is obtained from the page management class. The resources of the first page are loaded according to the rendering request, and the business processing result of the second page is updated to the resources of the first page. This completes the resource loading and page rendering of the first page at the current business process node. By configuring the page lifecycle management mechanism in the application, the current business process of the page is perceived, the current processing flow of the web page in the application is accurately located, and the current business of the page is accurately processed based on the process. This reduces unnecessary business processing and interface requests, improves the rendering and loading efficiency of the page, and reduces compatibility issues between native applications and web applications.
[0095] In some implementations, obtaining the number of times the first page is loaded in S1300 includes:
[0096] S1311. Obtain the application's view controller and view controller properties;
[0097] In one implementation, when obtaining the number of times the first page is loaded, the view controller and view controller properties of the application are first obtained, wherein the view controller properties are view controllers pre-configured during the development of the application, and the view controller properties are modified. Specifically, a parameter such as webApperCount that records the number of times the web page is redirected is added to the view controller properties.
[0098] It should be noted that the view controller properties include several properties that control the rendering of web pages; and, in the view controller, each web page is configured with corresponding view controller properties.
[0099] S1312. Obtain the page identifier of the first page.
[0100] After obtaining the application's view controller and view controller properties, obtain the page identifier of the first page, that is, obtain the identifier of the page that the application is currently requesting to render. Optionally, the page identifier of the first page can be the URL of the first page.
[0101] S1313. Obtain the pre-configured record parameters in the view controller properties according to the page identifier as the number of times the first page is loaded.
[0102] After obtaining the application's view controller and view controller properties, and obtaining the page identifier of the first page, the pre-configured record parameters in the view controller properties are obtained as the number of times the first page is loaded, based on the page identifier. Specifically, the parameter that records the number of times the web page is jumped is located from the view controller properties, and then filtered according to the page identifier of the first page, so as to obtain the pre-configured record parameters in the view controller properties as the number of times the first page is loaded.
[0103] This implementation accurately records the number of times the first page is loaded by pre-configuring the view controller in the application and adding parameters to the view controller properties to record the number of times the web page is redirected, thereby accurately recording the current business process of the first page.
[0104] In some implementations, after S1300 receives the application's rendering request for the first page and obtains the number of times the first page has been loaded, it further includes:
[0105] S1321. When the number of times the first page is loaded has not changed, obtain the target resource of the first page according to the rendering request of the first page;
[0106] After receiving a rendering request for the first page from the application and obtaining the number of times the first page has been loaded, if the number of times the first page has been loaded has not changed, the loading of the first page is not related to the business processing results of other web pages. That is, the current business process of the first page is not related to the business process of other web pages. At this time, the target resource of the first page is obtained according to the rendering request of the first page.
[0107] S1322. Load the first page according to the target resource;
[0108] After obtaining the target resource of the first page according to the rendering request of the first page, the first page is loaded according to the target resource. It is no longer necessary to request resources from other web pages first and then determine whether the resources need to be loaded. Instead, the first page is loaded according to the target resource, avoiding resource consumption and occupation caused by invalid resource requests.
[0109] This implementation accurately locates the resources required for the current business of the first page by recording the number of times the first page is loaded. It eliminates the need to request invalid resources from other web pages first, avoiding resource consumption and occupation caused by invalid resource requests, and improving page loading speed.
[0110] In some implementations, after determining that the application is running in the foreground, the method further includes:
[0111] S1211. Activate the preset listener program, which is used to listen to the page management class and the life cycle of the page, and the life cycle of the page includes the number of times the page is loaded.
[0112] After determining that the application is running in the foreground, a preset listener is activated. The listener is used to monitor the page management class and the lifecycle of the page. The page management class listener can obtain the content data and content data changes in the page management class, and the page lifecycle listener can obtain the business process parameters of the page. The page lifecycle includes the number of times the page is loaded.
[0113] In one implementation, a preset listener is activated when the application is launched. For example, when a user launches the application in a terminal, the listener is activated, that is, when the application changes from a non-running state to a running state, the listener is activated.
[0114] It should be noted that the running state of an application includes foreground running state and background running state. When the application is running in the background, the listening program can continue to run; when the application is in a frozen state, that is, when the application is cleared from the background, the listening program will be closed accordingly.
[0115] S1212. Activate the preset broadcast program, which is used to broadcast the page management class and the lifecycle of the page to the pages in the application.
[0116] Similarly, when the application is running, a preset broadcaster is activated. The broadcaster is used to broadcast page management classes and page lifecycles to pages in the application. The broadcaster can send broadcast notifications to various web pages to ensure the reception of messages and data on each web page, thereby ensuring the accuracy of the data loaded on the page.
[0117] This implementation method, by setting up a listener and a broadcaster, keeps the listener and broadcaster active in ascending order while the application is running. This effectively monitors the processing of page services and notifies each page, ensuring that the loading of related business results when the page loads is more accurate.
[0118] In some embodiments, the method further includes:
[0119] S1213. When the application is running in the background or frozen state, pause the listening program and the broadcasting program.
[0120] After activating the listener and broadcaster in the application, if the application's running state changes, for example, from foreground to background, the listener and broadcaster are paused. That is, the listener and broadcaster remain active but do not run, and no longer continuously listen and broadcast. When the application's running state changes from foreground to frozen, or from background to frozen, the listener and broadcaster are paused, and further, the listener and broadcaster are terminated.
[0121] This implementation controls the operation of the listening program and the broadcasting program according to the running status of the application, thereby avoiding resource consumption caused by the continuous running of the listening program and the broadcasting program in the background and improving resource utilization.
[0122] In some implementations, after loading the first page according to the rendering request of the first page and the business processing result of the second page, S1500 further includes:
[0123] S1511. When the application leaves the first page, obtain the page resources of the first page;
[0124] After loading the first page according to the rendering request of the first page and the business processing result of the second page, when the application leaves the first page, it obtains the page resources of the first page. The application leaving the first page includes the application jumping from the first page to the second page, or the application switching to background running state while displaying the first page. At this time, the page resources of the first page are obtained. The page resources include static resources and dynamic resources. Obtaining the page resources of the first page includes obtaining static resources or obtaining static resources and dynamic resources at the same time.
[0125] S1512. Save the page resources to the application cache and configure the cache validity period of the page resources to a preset period.
[0126] After obtaining the page resources of the first page, the page resources are saved to the application cache. The application cache can be accessed quickly, and loading data from the application cache can effectively improve the loading efficiency of related resources. At the same time, the cache validity period of the page resources is configured to a preset period, that is, a validity period is configured for various data stored in the application cache. The validity period indicates the duration for which resource data is stored in the application cache.
[0127] This implementation saves the application's page resources to the application cache after the application leaves the first page and sets a corresponding storage validity period, so as to quickly load relevant resource data through the application cache.
[0128] In some implementations, after saving the page resource to the application cache and configuring the cache validity period of the page resource to a preset period in step S1512, the method further includes:
[0129] S1513. If an operation to enter the first page is received within the preset period, the page resources of the first page are obtained from the application cache and then the first page is loaded.
[0130] After saving the page resources to the application cache and configuring the cache validity period of the page resources to a preset period, if an operation to enter the first page is received within the preset period, the page resources of the first page are retrieved from the application cache and then loaded. The operation of the application entering the first page includes the application returning to the first page from the second page, or the application re-triggering the operation to enter the first page URL, or the application switching from background running state to foreground running state, and the application is in the state of the first page when it switches to background running state. After the page resources of the first page stored in the application cache have expired, the application re-enters the first page, and the page resources can be retrieved from the application cache and the first page is loaded quickly, improving page loading efficiency.
[0131] S1514. If no operation to enter the first page is received from the application within the preset period, the page resources of the first page are released in the application cache.
[0132] After saving the page resources to the application cache and configuring the cache validity period of the page resources to a preset period, if no operation to enter the first page is received within the preset period, the page resources of the first page are released from the application cache. Expired resource data in the application cache is automatically released to avoid excessive resource consumption in the application cache. Furthermore, different resource data can be configured with different validity periods, allowing for more flexible management of resource data and improving the loading efficiency of different pages.
[0133] This implementation method quickly loads the newly opened first page by using the page resources of the first page saved in the application cache, effectively improving page loading efficiency.
[0134] In some implementations, the application is a native application under the iOS system, which contains an engine for loading web pages.
[0135] In this embodiment, the application runs on the iOS system and is a native application. A native application is a program developed based on the native application development rules of the iOS system. At the same time, web pages can be configured in the native application to flexibly adjust the relevant activities of the application. In order to enable the web pages configured in the native application to load effectively, the native application includes an engine for loading web pages. The engine can load and render web pages. Based on the above page loading method, the development difficulty of web pages in native applications can be reduced, and the loading efficiency of web pages in native applications in the iOS system can be effectively improved.
[0136] Please refer to details. Figure 2 , Figure 2 This is a schematic diagram of the basic structure of the page loading device in this embodiment.
[0137] like Figure 2As shown, a page loading device includes: a running status module 1100, a business management module 1200, a rendering request module 1300, a business acquisition module 1400, and a loading and rendering module 1500. The running status module 1100 is used to acquire the running status of the application; the business management module 1200 is used to acquire the application's page management class when the running status is foreground running, the page management class being used to store the business processing results of the second page; the rendering request module 1300 is used to acquire the number of times the first page is loaded in response to the application's rendering request for the first page; the business acquisition module 1400 is used to acquire the business processing results of the second page from the page management class when the number of times the first page is loaded changes; and the loading and rendering module 1500 is used to load the first page according to the rendering request of the first page and the business processing results of the second page.
[0138] The page loading device obtains the application's running state and analyzes its current running state. When the running state is in the foreground running state, it obtains the application's page management class, which stores the business processing results of the second page. If a rendering request for the first page is received at this time, in response to the application's rendering request for the first page, it obtains the loading count of the first page. The loading count of the first page is a parameter representing the lifecycle of the first page, enabling the application to record the current business processing flow of the first page. When the loading count of the first page changes, it obtains the business processing results of the second page from the page management class, loads the resources of the first page according to the rendering request, and updates the resources of the first page with the business processing results of the second page, completing the resource loading and page rendering of the first page at the current business process node. By configuring a page lifecycle management mechanism in the application, it realizes the perception of the current business process of the page, accurately locates the current processing flow of the web page in the application, accurately processes the current business of the page based on the flow, reduces unnecessary business processing and interface requests, improves page rendering and loading efficiency, and reduces compatibility issues between native applications and web applications.
[0139] Optionally, the rendering request module 1300 is further configured to:
[0140] Get the application's view controller and view controller properties;
[0141] Get the page identifier of the first page;
[0142] The pre-configured record parameters in the view controller properties are obtained based on the page identifier as the number of times the first page is loaded.
[0143] Optionally, the loading rendering module 1500 is further configured to:
[0144] When the number of loads of the first page does not change, obtain the target resource of the first page according to the rendering request of the first page;
[0145] The first page is loaded based on the target resource.
[0146] Optionally, the operating status module 1100 is further configured to;
[0147] Activate the preset listener, which is used to monitor the page management class and the lifecycle of the page, including the number of times the page is loaded;
[0148] Activate the preset broadcast program, which is used to broadcast the page management class and the page lifecycle to the pages in the application.
[0149] Optionally, the business management module 1200 is further used for;
[0150] When the application is running in the background or frozen state, the listening program and the broadcasting program are paused.
[0151] Optionally, the loading rendering module 1500 is further used for;
[0152] When the application leaves the first page, it retrieves the page resources of the first page;
[0153] Save the page resources to the application cache and configure the cache validity period of the page resources to a preset period.
[0154] Optionally, the loading rendering module 1500 is further configured to:
[0155] If an operation to enter the first page is received within the preset period, the page resources of the first page are retrieved from the application cache and then the first page is loaded.
[0156] If no operation to enter the first page is received from the application within the preset period, the page resources of the first page will be released from the application cache.
[0157] Optionally, the application is a native application under the iOS system, and the native application contains an engine for loading web pages.
[0158] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 3 , Figure 3 This is a basic structural block diagram of the computer device in this embodiment.
[0159] like Figure 3 The diagram shows the internal structure of a computer device. This computer device includes a processor, non-volatile storage medium, memory, and a network interface connected via a system bus. The non-volatile storage medium stores the operating system, database, and computer-readable instructions. The database may store a sequence of control information. When the computer-readable instructions are executed by the processor, they enable the processor to implement a transaction credential on-chain method. The processor provides computing and control capabilities, supporting the operation of the entire computer device. The memory stores computer-readable instructions, which, when executed by the processor, enable the processor to perform a page loading method. The network interface of the computer device is used for communication with a terminal. Those skilled in the art will understand that… Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0160] In this embodiment, the processor is used to execute... Figure 2 The specific functions of the running status module 1100, business management module 1200, rendering request module 1300, business acquisition module 1400, and loading rendering module 1500 are described. The memory stores the program code and various data required to execute the above modules. The network interface is used for data transmission between the user terminal and the server. In this embodiment, the memory stores the program code and data required to execute all sub-modules in the page loading device, and the server can call the server's program code and data to execute the functions of all sub-modules.
[0161] The computer device obtains the running status of the application and analyzes its current running state. When the running state is in the foreground running state, it obtains the application's page management class, which stores the business processing results of the second page. If a rendering request for the first page is received at this time, in response to the application's rendering request for the first page, it obtains the loading count of the first page. The loading count of the first page is a parameter representing the lifecycle of the first page, enabling the application to record the current business processing flow of the first page. When the loading count of the first page changes, it obtains the business processing results of the second page from the page management class, loads the resources of the first page according to the rendering request, and updates the resources of the first page with the business processing results of the second page, completing the resource loading and page rendering of the first page at the current business process node. By configuring the page lifecycle management mechanism in the application, it realizes the perception of the current business process of the page, accurately locates the current processing flow of the web page in the application, accurately processes the current business of the page based on the flow, reduces unnecessary business processing and interface requests, improves the rendering and loading efficiency of the page, and reduces compatibility issues between native applications and web applications.
[0162] This application also provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the page loading method of any of the above embodiments.
[0163] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0164] Those skilled in the art will understand that the steps, measures, and solutions in the various operations, methods, and processes discussed in this application can be alternated, modified, combined, or deleted. Furthermore, other steps, measures, and solutions in the various operations, methods, and processes discussed in this application can also be alternated, modified, rearranged, decomposed, combined, or deleted. Furthermore, steps, measures, and solutions in the prior art that are similar to those disclosed in this application can also be alternated, modified, rearranged, decomposed, combined, or deleted.
[0165] The above description is only a partial embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A page loading method, characterized in that, include: Get the running status of the application; When the running state is the foreground running state, the page management class of the application is obtained, and the page management class is used to store the business processing results of the second page; In response to the application's rendering request for the first page, the number of times the first page is loaded is obtained; Get the previous load count of the first page. If the current load count is different from the previous load count, determine that the load count of the first page has changed. The change in the number of loads is triggered when the user navigates from the first page to the second page, and then navigates back to the first page from the second page. When the number of times the first page is loaded changes, the business processing result of the second page is obtained from the page management class; The first page is loaded based on the rendering request of the first page and the business processing result of the second page; The step of obtaining the load count of the first page includes: obtaining the application's view controller and view controller properties; obtaining the page identifier of the first page; and obtaining the pre-configured record parameters in the view controller properties as the load count of the first page based on the page identifier.
2. The page loading method according to claim 1, characterized in that, After obtaining the number of times the first page is loaded in response to the application's rendering request for the first page, the method further includes: When the number of loads of the first page does not change, obtain the target resource of the first page according to the rendering request of the first page; The first page is loaded based on the target resource.
3. The page loading method according to claim 1, characterized in that, After determining that the application is running in the foreground, the process further includes: Activate the preset listener, which is used to monitor the page management class and the lifecycle of the page, including the number of times the page is loaded; Activate the preset broadcast program, which is used to broadcast the page management class and the page lifecycle to the pages in the application.
4. The page loading method according to claim 3, characterized in that, The method further includes: When the application is running in the background or frozen state, the listening program and the broadcasting program are paused.
5. The page loading method according to claim 1, characterized in that, After loading the first page according to the rendering request of the first page and the business processing result of the second page, the process further includes: When the application leaves the first page, it retrieves the page resources of the first page; Save the page resources to the application cache and configure the cache validity period of the page resources to a preset period.
6. The page loading method according to claim 5, characterized in that, After saving the page resources to the application cache and configuring the cache validity period of the page resources to a preset period, the method further includes: If an operation to enter the first page is received within the preset period, the page resources of the first page are retrieved from the application cache and then the first page is loaded. If no operation to enter the first page is received from the application within the preset period, the page resources of the first page will be released from the application cache.
7. A page loading device, characterized in that, include: The runtime status module is used to obtain the runtime status of the application; The business management module is used to obtain the application's page management class when the running state is the foreground running state. The page management class is used to store the business processing results of the second page. The rendering request module is used to respond to the application's rendering request for the first page and obtain the number of times the first page has been loaded. The business acquisition module is used to obtain the previous load count of the first page. When the current load count is different from the previous load count, it is determined that the load count of the first page has changed. The change in the number of loads is triggered when the user navigates from the first page to the second page, and then navigates back to the first page from the second page. When the number of times the first page is loaded changes, the business processing result of the second page is obtained from the page management class; The rendering module is used to load the first page based on the rendering request of the first page and the business processing result of the second page. The rendering request module is also used to: obtain the application's view controller and view controller properties; Obtain the page identifier of the first page; based on the page identifier, obtain the pre-configured record parameter in the view controller properties as the number of times the first page is loaded.
8. A computer device comprising a memory and a processor, the memory storing computer-readable instructions which, when executed by the processor, cause the processor to perform the steps of the page loading method as claimed in any one of claims 1 to 6.
9. A storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the page loading method as claimed in any one of claims 1 to 6.