Page loading method, electronic equipment and computer readable storage medium
By using offline data packets in electronic devices for page rendering and online data update rendering when the network status is online, the problem of slow page loading speed is solved, the user experience is improved and the timeliness and accuracy of page content is guaranteed.
Patent Information
- Application Number
- CN202410752181.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, page loading speed is slow, resulting in poor user experience.
By using offline data packets in electronic devices for page rendering, and obtaining online page data for update rendering when the network status is online, to ensure the timeliness and accuracy of page content.
It realizes the fast opening of the page, improves the page loading speed, optimizes the page display effect, and ensures the timeliness and accuracy of the displayed content.
Smart Images

Figure CN119884513A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a page loading method, an electronic device, and a computer-readable storage medium. Background Art
[0002] As application services continue to grow, pages need to carry more business scenarios and respond quickly to business needs to meet development needs. However, page loading solutions in related technologies usually have problems such as slow loading speed and poor user experience. Summary of the invention
[0003] In order to solve the above technical problems, the embodiments of the present application provide a page loading method, an electronic device and a computer-readable storage medium, which can solve the problem of slow page loading speed to a certain extent and ensure the timeliness and accuracy of the displayed content.
[0004] In a first aspect, an embodiment of the present application provides a page loading method, which is applied to an electronic device, comprising: in response to a page trigger operation of a user within an application, starting a corresponding page window; obtaining offline page data corresponding to the page window from an offline data packet corresponding to the application; using the offline page data to render a page and displaying it in the page window; obtaining a network status of the electronic device; when the network status of the electronic device is online, obtaining online page data; when there is a deviation between the online page data and the offline page data, rendering the page based on the online page data and updating the content displayed in the page window.
[0005] In a second aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is run by the processor, the page loading method provided in the first aspect is executed.
[0006] In a third aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which executes the page loading method provided in the first aspect when running on a processor.
[0007] The page loading method, electronic device and computer-readable storage medium provided in the present application start the corresponding page window in response to the page trigger operation of the user in the application; obtain the offline page data corresponding to the page window from the offline data packet corresponding to the application; use the offline page data to render the page and display it in the page window; obtain the network status of the electronic device; when the network status of the electronic device is online, obtain the online page data; when there is a deviation between the online page data and the offline page data, render the page based on the online page data and update the content displayed in the page window.
[0008] Through the above method, the offline page data of the local offline data package is used to render the page, so that the page can be opened quickly and the page loading speed can be improved. Moreover, when it is determined that the electronic device is online, the online page data can also be used to update and render the displayed page, optimize the page display effect, and ensure the timeliness and accuracy of the displayed content. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are numbered similarly.
[0010] Figure 1 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application is shown;
[0011] Figure 2 A schematic diagram of a process of a page loading method provided by an embodiment of the present application is shown;
[0012] Figure 3 A flow chart of step S206 of the page loading method provided in an embodiment of the present application is shown;
[0013] Figure 4 Another schematic diagram of the process of the page loading method provided by the embodiment of the present application is shown;
[0014] Figure 5 A flow chart of step S207 of the page loading method provided in an embodiment of the present application is shown;
[0015] Figure 6 A schematic diagram of a process of step S209 of the page loading method provided in an embodiment of the present application is shown;
[0016] Figure 7 Another flow chart of the page loading method provided in the embodiment of the present application is shown.
[0017] Icon: 100 - electronic device, 101 - transceiver, 102 - processor, 103 - memory. DETAILED DESCRIPTION
[0018] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0019] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0020] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.
[0021] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.
[0022] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0023] An embodiment of the present application provides a page loading method, which is applied to an electronic device. The specific structure of the electronic device is described below.
[0024] See also Figure 1 , the electronic device 100 includes a transceiver 101, a bus interface, a processor 102 and a memory 103. Figure 1In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by the processor 102 and various circuits of the memory represented by the memory 103 are connected together. The bus interface provides an interface, and the bus interface can also connect various other circuits such as peripheral devices, voltage regulators and power management circuits together, which are well known in the art, so it will not be further described in this article. The transceiver 101 can be a plurality of components, that is, including a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium. The processor 102 is responsible for managing the bus architecture and general processing, and the memory 103 can store data used by the processor 102 when performing operations. The memory 103 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the memory 103 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0025] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0026] See also Figure 2 , which is a flow chart of a page loading method provided by an embodiment of the present application, and the page loading method can be applied to Figure 1 In the electronic device 100 shown.
[0027] Step S201, in response to a page triggering operation by a user in an application, starting a corresponding page window.
[0028] In this embodiment, the application program may be a game program, a social program, or a browser, etc., and the page trigger operation may be a click operation, a long press operation, a floating gesture, or a sliding operation, etc., which are not limited here. Among them, the page window is a window for displaying a specific page, for example, it can be an H5 (HTML5) page window, an RN (React Native) page window, etc.
[0029] Exemplarily, the content currently displayed by the application may include one or more page options. After the user clicks on one of the page options in the application, a page window corresponding to the clicked page option is displayed.
[0030] Step S202: Obtain offline page data corresponding to the page window from the offline data packet corresponding to the application.
[0031] It should be noted that one or more application programs may be installed in the electronic device, and one application program may correspond to one or more offline data packages.
[0032] The offline data packet may include offline page data corresponding to one or more page windows.
[0033] The content contained in the above-mentioned offline page data can be set according to actual needs. Exemplarily, the above-mentioned offline page data may include content such as page frame design and page display data. Taking the "Help" page window as an example, the page display data of the page window may include question and answer materials for preset questions, etc.
[0034] It should be noted that the offline data packet may be actively pushed by the server to the electronic device, and / or the offline data packet may also be requested by the electronic device from the server regularly or irregularly according to a preset update mechanism.
[0035] In some embodiments, the electronic device can store an offline data packet in a fixed address. When a user's page trigger operation is detected, a routing parameter can be determined in response to the trigger operation. Afterwards, the offline page data of the corresponding page window is determined from the offline data packet in combination with the pre-configured fixed address and routing parameters. For example, assuming that the fixed address of the offline data packet of the electronic device is file: / / / xxx / index.html; after detecting the user's page trigger operation, the corresponding routing parameter can be determined to be / us / spec; then, the two are combined to obtain a complete path of file: / / / xxx / index.html# / us / spec, where the # before the pound sign represents the fixed address, and the # after the pound sign represents the routing parameter. The offline page data of the corresponding page window can be obtained by accessing file: / / / xxx / index.html# / us / spec.
[0036] Placing offline data packets at a fixed address and pointing to offline data in different page windows through routing parameters facilitates unified management of offline data packets, with minimal changes to the native application.
[0037] In some embodiments, the page loading method further includes: receiving business-critical information transmitted by the application, and accordingly, step S202 includes: searching for data corresponding to the business-critical information from an offline data packet corresponding to the application to obtain offline page data corresponding to the page window.
[0038] In this embodiment, the application can pass public information to the page window in advance when opening the page window. The public information may include one or more of the following information: data center (site), multi-language (lang), current network status (online), user information (token), application version number (version), and business-critical information (appMoreInfo).
[0039] The business key information is used to indicate information such as the business type, business object, etc. of the page window triggered by the page trigger operation. For example, the business key information may include information such as a unique identity of a specific device.
[0040] After the application actively injects business-critical information into the page window, the page window can quickly search for offline page data corresponding to the page window in the offline data packet of the application directly based on the business-critical information. For example, the user performs a page trigger operation in the application, and the application responds to the page trigger operation and opens the page window of the help feedback page of device A. At this time, the application can inject the unique identity of device A into the page window in advance, so that the page window can obtain the question and answer information corresponding to device A (i.e., offline page data) in the offline data packet based on the unique identity of device A.
[0041] In the related art, the page window usually needs to request specific components (such as Native) to obtain business-critical information. In this embodiment, the application can inject business-critical information and other public information into the page window in advance when opening the page window, so that the page window can directly obtain the offline page data corresponding to the page window from the offline data packet based on the business-critical information, cutting the process of the page window requesting business-critical information, thereby improving the query speed of offline page data and reducing time loss.
[0042] In some embodiments, the application and the page window can determine in advance the key used to encrypt the communication content. When the application transmits content such as business-critical information, it can use the agreed key to encrypt the transmitted content to improve the security of the information. For example, the application can use the AES encryption algorithm to encrypt business-critical information, pass the encrypted data to the electronic device, and the electronic device uses CryptoJS-AES to decrypt the encrypted data to obtain business-critical information, thereby improving the security of data transmission.
[0043] In some embodiments, the application may also register a register method so that the page window may call more functions of the application and actively obtain more information by calling the register method.
[0044] In some embodiments, the application can actively pass information to the page window. For example, the application can actively pass the message to a specific object, such as an appNotifyMessage object; the page window can obtain the information passed by the application in real time by monitoring the appNotifyMessage object to cope with more complex business scenarios.
[0045] Step S203: Use the offline page data to render the page and display it in the page window.
[0046] After obtaining the offline page data, the offline page data can be used to render the page. After the rendering is completed, the rendered image is displayed in the page window.
[0047] For example, assuming that the offline page data is the question and answer material in the aforementioned example, the question and answer material can be used to render the page, and the rendered content can be displayed in the page window, so that the user can quickly see the question and answer material displayed in the page window, thereby improving the page loading speed.
[0048] In the actual testing process, the loading time of most page windows can be reduced to about 500ms. In the conventional evaluation standards in the industry, a page window loading speed less than or equal to 1.8s is rated as excellent (Good). Therefore, using this solution to load page windows can give users a better experience.
[0049] Through the above method, since the page window directly obtains offline page data from the local electronic device for rendering, there is no need to request online page data from the server. It can enter the rendering process and present the rendered page content at a faster speed, thereby speeding up the page loading speed and improving the user experience.
[0050] Step S204: obtaining the network status of the electronic device.
[0051] In this embodiment, the network state may include an online state or an offline state. If the electronic device is in an offline state, it cannot communicate with the server and cannot update the page data; if the electronic device is in an online state, it can further determine whether it is necessary to update the page window.
[0052] Step S205, when the network status of the electronic device is online, obtaining online page data.
[0053] In this embodiment, the electronic device is online, and requests the server through the network for online page data corresponding to the page window to determine whether the content of the page window needs to be updated based on the online page data and offline page data of the page window.
[0054] In one case, the local offline page data of the electronic device and the online page data of the page window are the same and do not need to be updated.
[0055] In another case, there may be deviation data between the local offline page data of the electronic device and the online page data of the page window, and the corresponding content displayed in the page window may be updated based on the online page data.
[0056] Step S206, when there is a deviation between the online page data and the offline page data, page rendering is performed based on the online page data, and the content displayed in the page window is updated.
[0057] In this embodiment, the electronic device can perform deviation calculation on the online page data and the offline page data through a preset deviation algorithm to determine whether there is a deviation between the online page data and the offline page data. The time consumed by the deviation calculation of the deviation algorithm is very short and can be almost ignored. For example, the deviation algorithm can be the diff algorithm provided by the react framework.
[0058] In the scenario of actually evaluating the page loading speed, the time (First Contentful Paint, FCP) when visual content (including text, pictures, videos, canvas, etc.) first appears on the page can be used as a web page performance indicator. By using the page loading method provided in this embodiment, the average FCP time of page loading can be reduced to about 500ms.
[0059] It should be understood that in most related technologies, the page window will request online page data from the server. After the server feeds back the online page data, the page window can display the corresponding content. In this way, the loading speed of the page window will be limited by whether the electronic device is online and the communication bandwidth of the electronic device. If the electronic device is offline, the page window cannot obtain the corresponding online page data and cannot display the corresponding content; if the electronic device is online, but the communication bandwidth is small, the page window also takes a long time to load and display the corresponding content.
[0060] In some other related technologies, there are also schemes that propose the idea of offline packages. However, in these schemes, the page window still requests online page data from the corresponding server, and the application intercepts the request of the page window and changes the address of the request to the local offline package address, thereby returning the local offline page data. However, this type of method requires the application to intercept and requires a major transformation of the native end of the application, which is difficult. Moreover, due to the update frequency of the offline package, obtaining offline page data from the local offline package for display will cause a certain lag in the content displayed in the page window, and may even display incorrect content.
[0061] The method provided by this application uses the offline page data of the local offline data package to render the page, which can quickly open the page and improve the page loading speed; moreover, since the page window directly searches for the local offline page data for the initial rendering, instead of requesting the online page data from the server, there is no need for the application to intercept the request, which reduces the changes to the native end of the application. In addition, when it is determined that the electronic device is online, the online page data can also be used to update and render the displayed page, optimize the page display effect, and ensure the timeliness and accuracy of the displayed content.
[0062] See also Figure 3 , step S206 includes step S2061-step S2063, and each step is described below.
[0063] Step S2061, obtaining deviation data in the online page data that deviates from the offline page data.
[0064] Step S2062: Perform local rendering based on the deviation data to obtain a local updated picture.
[0065] Step S2063: Use the local update screen to update the corresponding content displayed in the page window.
[0066] It should be noted that when using online page data for page rendering and updating, the deviation data between the online page data and the offline page data can be determined through a deviation algorithm, and the displayed page window can be partially rendered based on the deviation data to update the content of the page window.
[0067] In this process, the page window continues to display content, and only the local window content is modified or replaced to ensure that the user has a good experience. Exemplarily, based on the display of the "Help Feedback Page" in the aforementioned example, it is further explained that after the "Help Feedback Page" is rendered and displayed according to the question and answer data of the offline page data, it is determined that the electronic device is online, so the online page data is obtained from the server, and the question and answer data in the online page data is compared with the question and answer data in the offline page data. At this time, if it is determined that there is deviation data between the two, the local page of the "Help Feedback Page" is locally rendered based on the deviation data. For example, suppose that the "Help Feedback Page" generated based on the rendering of the offline page data shows that "Device X is drunk and supports 600W heating equipment to work", where the word "drunk" is a typo. In the question and answer data of the online page data, "drunk" has been updated to "most", then "drunk" can be replaced and rendered with "most" for the deviation data, and other places remain unchanged.
[0068] In one embodiment, see Figure 4 The method also includes steps S207 to S2010.
[0069] Step S207: When the preset update condition is met, an update check operation of the offline data package is performed.
[0070] In this embodiment, the preset update condition can be set based on the screen state of the electronic device and / or the running state of the application. For example, the preset update condition may include the electronic device entering the unlocked state from the locked screen state, cold starting the application, detecting that the user manually clicks the update button, etc.; or, the preset update condition may also include that the application is in a high-frequency state, etc. Among them, the high-frequency state may be that the application is used more than a preset number of times in a unit time, for example, the unit time may be 1 hour, and the preset number of times may be 3 times.
[0071] In one embodiment, step S207 includes:
[0072] When the application is started, an update check operation of the offline data package is performed.
[0073] It is understandable that when starting an application, it can be clear that the user needs to use the application. At this time, an update check operation for the offline data package can be performed to obtain an update check result so as to determine whether a new offline data package needs to be downloaded to replace the existing offline data package, thereby ensuring the timeliness of the offline data package as much as possible.
[0074] See also Figure 5 , perform an update check operation of the offline data packet, including steps S2071-S2073.
[0075] S2071, obtain the first version number of the latest offline data package in the server.
[0076] S2072: Obtain a second version number of the offline data package stored in the electronic device.
[0077] S2073: When the first version number does not match the second version number, determine that a new offline data packet exists.
[0078] Exemplarily, the electronic device can determine the first version number of the latest offline data package through the server, and compare the first version number with the second version number of the local offline data package. If the two do not match, it means that the offline data package in the server is newer and the latest offline data package needs to be downloaded to the local electronic device; if the two match, it means that the offline data stored locally in the electronic device is the latest version and does not need to be updated.
[0079] Step S208: when it is determined based on the update check operation that a new offline data package exists, download the new offline data package.
[0080] Exemplarily, the electronic device sends a download request instruction to the server, the server sends a new offline data packet to the electronic device according to the download request instruction, and the electronic device receives the new offline data packet.
[0081] Step S209, decompress the new offline data package and verify the decompressed file.
[0082] In this embodiment, the decompressed file can be verified. If the verification is successful, it means that the new offline data package contains complete data and can be used normally; if the verification fails, it means that the new offline data package has a download error or a decompression error and needs to be downloaded or decompressed again.
[0083] It should be understood that in related solutions, usually only errors occur during the communication process, such as packet loss. However, in actual application scenarios, it is possible that the communication process is normal, but the decompression of the offline data packet is wrong. In this case, using the offline data packet with decompression error may cause abnormal page display.
[0084] Therefore, in the method of this embodiment, after the new offline data packet is decompressed, the decompressed file is also verified to ensure that the correct file can be used for page display later.
[0085] See also Figure 6 , step S209 includes step S2091-step S2093.
[0086] Step S2091, decompress the new offline data package to obtain a resource file and a verification file.
[0087] In this embodiment, the resource file is a file used for page rendering, and the verification file records the file attribute information of the resource file.
[0088] In some embodiments, the file attribute information may include one or more of the file name, file path, and other information of the resource file. Exemplarily, the verification file may be an ef-mainfest.json file. For example, the webpackMainfestPlugin plugin is used to generate and output the ef-mainfest.json file, which includes the file name of the resource file.
[0089] Step S2092: Compare the file attribute information recorded in the verification file with the file attribute information of the resource file.
[0090] In this embodiment, the file attribute information recorded in the verification file is traversed and judged in turn whether it matches the file attribute information of the resource file. If the file attribute information of one or more resource files does not match the file attribute information recorded in the verification file, the verification fails; if the file attribute information of all resource files matches the file attribute information recorded in the verification file, the verification passes.
[0091] Step S2093: When the file attribute information recorded in the verification file matches the file attribute information of the resource file, it is determined that the verification is passed.
[0092] When the file attribute information of all resource files matches the file attribute information recorded in the verification file, it can be determined that the new offline data packet passes the verification, and the decompressed resource files can be kept for subsequent use.
[0093] Step S2010: When the verification passes, the offline data package locally stored in the electronic device is replaced with the new offline data package.
[0094] When the verification is passed, the offline data package stored locally is replaced by the new offline data package that has passed the verification, and the version number of the new offline data package is recorded, so that the offline data package can be updated in time to ensure the accuracy and timeliness of the new offline data package.
[0095] In one embodiment, see Figure 7 The method also includes steps S2011-S2012.
[0096] Step S2011, when the file attribute information recorded in the verification file does not match the file attribute information of the resource file, it is determined that the verification has failed.
[0097] If the verification fails, it may indicate that there is an error in the download process, or there may be an error in the decompression process, which needs to be reprocessed.
[0098] Step S2012, when the verification fails, re-download the new offline data package, and / or re-execute the step of decompressing the offline data package and verifying the decompressed file.
[0099] It should be noted that if the download process is wrong, you need to re-download a new offline data package, and re-decompress and verify the downloaded new offline data package to ensure the accuracy of the re-downloaded new offline data package. If the decompression process is wrong, re-decompress the new offline data package and perform verification to re-confirm the accuracy of the decompressed resource file.
[0100] The page loading method provided in this embodiment starts a corresponding page window in response to a page trigger operation of a user in an application; obtains offline page data corresponding to the page window from an offline data packet corresponding to the application; uses the offline page data to render the page and displays it in the page window; obtains the network status of the electronic device; when the network status of the electronic device is online, obtains online page data; when there is a deviation between the online page data and the offline page data, renders the page based on the online page data and updates the content displayed in the page window.
[0101] The method provided in the present application can use the offline page data of the local offline data package to render the page, quickly open the page, and then use the online page data to partially update and render the displayed page, thereby optimizing the page display effect.
[0102] In addition, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the page loading method provided in Embodiment 1 is executed.
[0103] Please see again Figure 1 , processor 102, is used to start the corresponding page window in response to the page trigger operation of the user in the application; obtain the offline page data corresponding to the page window from the offline data packet corresponding to the application; use the offline page data to render the page and display it in the page window; obtain the network status of the electronic device; when the network status of the electronic device is online, obtain the online page data; when there is a deviation between the online page data and the offline page data, render the page based on the online page data and update the content displayed in the page window.
[0104] In one embodiment, the processor 102 is further configured to receive business-critical information transmitted by the application; search for data corresponding to the business-critical information from an offline data packet corresponding to the application, and obtain offline page data corresponding to the page window.
[0105] In one embodiment, the processor 102 is further used to obtain deviation data in the online page data that deviates from the offline page data; perform local rendering based on the deviation data to obtain a local update screen; and use the local update screen to update the corresponding content displayed in the page window.
[0106] In one embodiment, the processor 102 is further used to perform an update check operation on the offline data packet when a preset update condition is met; when it is determined based on the update check operation that a new offline data packet exists, download the new offline data packet; decompress the new offline data packet and verify the decompressed file; when the verification passes, use the new offline data packet to replace the offline data packet stored locally on the electronic device.
[0107] In one embodiment, the processor 102 is further used to decompress the new offline data packet to obtain a resource file and a verification file; the verification file records the file attribute information of the resource file; the file attribute information recorded in the verification file is compared with the file attribute information of the resource file; when the file attribute information recorded in the verification file matches the file attribute information of the resource file, it is determined that the verification is passed.
[0108] In one embodiment, the processor 102 is further used to determine that the verification has failed when the file attribute information recorded in the verification file does not match the file attribute information of the resource file; when the verification fails, re-download the new offline data packet, and / or re-execute the steps of decompressing the offline data packet and verifying the decompressed file.
[0109] In one implementation, the processor 102 is further configured to perform an update check operation of the offline data packet when starting the application.
[0110] In one embodiment, the processor 102 is further configured to obtain a first version number of the latest offline data packet in the server; obtain a second version number of the offline data packet stored in the electronic device;
[0111] When the first version number does not match the second version number, it is determined that a new offline data packet exists.
[0112] The electronic device provided in this embodiment can implement the page loading method provided in Embodiment 1, and its implementation principle and technical effect are similar, so they will not be described here to avoid repetition.
[0113] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the page loading method provided in Example 1 is implemented.
[0114] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0115] The computer-readable storage medium provided in this embodiment can implement the page loading method provided in Embodiment 1. The implementation principle and technical effect are similar, and will not be described here to avoid repetition.
[0116] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or terminal including the element.
[0117] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0118] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A page loading method, characterized in that: Used in electronic equipment, including: In response to a page trigger operation by a user in an application, a corresponding page window is started; Obtaining offline page data corresponding to the page window from the offline data packet corresponding to the application; Using the offline page data to render the page, and displaying it in the page window; Acquiring the network status of the electronic device; When the network status of the electronic device is online, acquiring online page data; When there is a deviation between the online page data and the offline page data, page rendering is performed based on the online page data, and content displayed in the page window is updated.
2. The method according to claim 1, characterized in that The method further comprises: receiving business-critical information delivered by the application; Correspondingly, obtaining offline page data corresponding to the page window from the offline data packet corresponding to the application includes: The data corresponding to the business-critical information is searched from the offline data packet corresponding to the application program to obtain the offline page data corresponding to the page window.
3. The method according to claim 1, characterized in that The performing page rendering based on the online page data and updating the content displayed in the page window includes: Acquire deviation data of the online page data that deviates from the offline page data; Perform local rendering based on the deviation data to obtain a local updated picture; The local update screen is used to update the corresponding displayed content in the page window.
4. The method according to claim 1, characterized in that: The method further comprises: When a preset update condition is met, performing an update check operation of the offline data packet; When it is determined that there is a new offline data packet based on the update checking operation, downloading the new offline data packet; Decompressing the new offline data packet and verifying the decompressed file; When the verification is passed, the new offline data packet is used to replace the offline data packet stored locally in the electronic device.
5. The method according to claim 4, characterized in that The decompressing the new offline data packet and verifying the decompressed file includes: Decompressing the new offline data packet to obtain a resource file and a verification file; the verification file records the file attribute information of the resource file; Comparing the file attribute information recorded in the verification file with the file attribute information of the resource file; When the file attribute information recorded in the verification file matches the file attribute information of the resource file, it is determined that the verification is passed.
6. The method according to claim 5, characterized in that After comparing the file attribute information recorded in the verification file with the file attribute information of the resource file, the method further includes: When the file attribute information recorded in the verification file does not match the file attribute information of the resource file, determining that the verification fails; When the verification fails, the new offline data package is downloaded again, and / or the steps of decompressing the offline data package and verifying the decompressed file are re-executed.
7. The method according to claim 4, characterized in that When the preset update condition is met, executing the update check operation of the offline data packet includes: When the application is started, an update check operation of the offline data package is performed.
8. The method according to any one of claims 4 to 7, characterized in that The performing of the update check operation of the offline data packet includes: Get the first version number of the latest offline data package in the server; Obtaining a second version number of the offline data packet stored in the electronic device; When the first version number does not match the second version number, it is determined that a new offline data packet exists.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is run by the processor, the page loading method according to any one of claims 1 to 8 is executed.
10. A computer-readable storage medium, characterized in that: The computer program stores a computer program, which executes the page loading method according to any one of claims 1 to 8 when running on a processor.