Offline package generation method, webpage rendering method, electronic equipment and medium

By generating main and sub-offline packages through pre-accessing the target webpage and combining this with an differential update mechanism, the problem of slow web page loading speed in hybrid applications is solved, enabling fast rendering and efficient updates, thus improving the user experience.

CN122019899APending Publication Date: 2026-05-12HANGZHOU NETEASE CLOUD MUSIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HANGZHOU NETEASE CLOUD MUSIC TECH CO LTD
Filing Date
2025-12-15
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

The slow loading speed and long rendering time of web pages in existing hybrid applications are mainly due to the fact that the size of the offline package is too large or too small, which cannot accurately reflect the resource loading status in the real user environment, resulting in a poor user experience.

Method used

By pre-visiting the target webpage, the main static resources are obtained based on the Uniform Resource Locator (URL), compressed to generate the main offline package, and non-first-screen resources are separated into sub-offline packages. Combined with the differential update mechanism of anchor version numbers, accurate static resource packaging and fast rendering are achieved.

Benefits of technology

It improves web page loading speed and user experience, reduces network dependency, reduces resource redundancy and storage costs, and enhances the update efficiency of hybrid applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122019899A_ABST
    Figure CN122019899A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses an offline package generation method, a webpage rendering method, electronic equipment and a medium. The method comprises the steps of obtaining a static resource file of a target webpage to be rendered and a uniform resource locator corresponding to the static resource file, wherein the static resource file is constructed by a construction server based on a source code file corresponding to the target webpage; pre-accessing the target webpage based on the uniform resource locator, and generating a main static resource corresponding to the target webpage; and compressing the main static resource to generate a main offline package corresponding to the target webpage. By implementing the method provided by the invention, the situations that the offline package is too large and contains unnecessary static resources and the offline package is too small in size and lacks static resources required for displaying the Web page of the first screen can be avoided, so that the problem that the loading time of the Web page is relatively long is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, specifically to methods for generating offline packages, methods for rendering web pages, electronic devices, and media. Background Technology

[0002] With the development of mobile internet technology, hybrid applications have become the mainstream development method for mobile applications due to their combination of the excellent user experience of native applications and the efficient development advantages of web development platforms. However, the loading of web pages in hybrid applications is heavily dependent on the network environment. The static resources required, such as interactive script files (JavaScript files), style resource files (CSS files), images, and text, need to be obtained from the server in real time through network requests. This can easily lead to slow web page loading speeds and long rendering times due to factors such as network latency and bandwidth fluctuations.

[0003] Therefore, the static resources required to run a web page are typically split and packaged into multiple offline packages, which are then integrated into the installation package of a hybrid application or downloaded to the user's device in advance via the network and stored locally. Currently, splitting and packaging the static resources required to run a web page based on developers' experience and static analysis can easily result in offline packages that are too large and contain unnecessary static resources, or offline packages that are too small and lack the static resources required to display the first screen of the web page. This leads to longer web page loading times and a poor user experience. Summary of the Invention

[0004] This invention provides a method for generating offline packages, a method for rendering web pages, an electronic device, and a medium to solve the problem of long loading times for web pages.

[0005] In a first aspect, the present invention provides a method for generating an offline package, the method comprising: obtaining a static resource file of a target webpage to be rendered and a Uniform Resource Locator (URL) corresponding to the static resource file, wherein the static resource file is constructed by a building server based on the source code file corresponding to the target webpage; pre-accessing the target webpage based on the URL to generate a main static resource corresponding to the target webpage; and compressing the main static resource to generate a main offline package corresponding to the target webpage.

[0006] Secondly, the present invention provides a method for rendering a webpage, the method comprising: in response to an opening operation by a client, obtaining a main offline package corresponding to a target webpage, wherein the main offline package is obtained by compressing main static resources, the main static resources are generated by pre-accessing the target webpage based on the Uniform Resource Locator corresponding to the static resource file, and the static resource file is constructed by a construction server based on the source code file corresponding to the target webpage; and rendering the target webpage based on the main static resources corresponding to the main offline package.

[0007] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the offline package generation method of the first aspect or any corresponding embodiment thereof, or the webpage rendering method of the second aspect or any corresponding embodiment thereof.

[0008] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions, which are used to cause a computer to execute the offline package generation method of the first aspect or any corresponding embodiment thereof, or the webpage rendering method of the second aspect or any corresponding embodiment thereof.

[0009] The offline package generation method provided in this embodiment pre-accesses the target webpage based on the Uniform Resource Locator (URL) corresponding to the static resource files. This allows for accurate determination of the actual resource loading status of the target webpage in a real user environment, as well as the accurate identification of the main static resources required for the initial display of the target webpage when a user accesses it. By compressing the main static resources to obtain the main offline package, a more accurate differential packaging of the static resource files corresponding to the target webpage is achieved. This avoids situations where the offline package is too large and contains unnecessary static resources, or too small and lacks the static resources required for displaying the initial webpage, thereby solving the problem of long webpage loading times.

[0010] The webpage rendering method provided in this embodiment downloads the main offline package from the content distribution server in advance based on the main download link when the client starts. When accessing the target webpage, the main offline package is used to render the target webpage, thus achieving a faster loading speed for the target webpage and further improving the user experience. Attached Figure Description

[0011] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0012] Figure 1 This is a sequence diagram of offline packet generation in non-fragmentation scenarios; Figure 2 It is a sequence diagram of incremental updates between adjacent versions; Figure 3 This is a diagram illustrating differential updates between any versions; Figure 4 This is a schematic diagram of an application scenario according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the first process of generating an offline package according to an embodiment of the present invention; Figure 6 This is a schematic diagram of a second process for generating an offline package according to an embodiment of the present invention; Figure 7 This is a timing diagram of a specific method for generating an offline package according to an embodiment of the present invention; Figure 8 This is a schematic diagram of the first process of rendering a webpage according to an embodiment of the present invention; Figure 9 This is a timing diagram of the client downloading the main offline package and the sub-offline package according to an embodiment of the present invention; Figure 10 This is a schematic diagram of the third process of generating an offline package according to an embodiment of the present invention; Figure 11 This is a timing diagram of the offline package server generating differential packets according to an embodiment of the present invention; Figure 12 This is a schematic diagram of a second process for rendering a webpage according to an embodiment of the present invention; Figure 13 This is a timing diagram of the differential update for upgrading a local offline package on a client to a new offline package according to an embodiment of the present invention; Figure 14 This is a structural block diagram of an offline package generation apparatus according to an embodiment of the present invention; Figure 15 This is a structural block diagram of a webpage rendering apparatus according to an embodiment of the present invention; Figure 16 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0014] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.

[0015] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0016] With the development of mobile internet technology, hybrid applications have become the mainstream development method for mobile applications due to their combination of the excellent user experience of native applications and the efficient development advantages of web development platforms. In hybrid applications, many business functions are implemented by loading web pages through the built-in WebView component (a browser kernel component embedded in the native application). However, the loading of web pages in hybrid applications is heavily dependent on the network environment. The required static resources, such as interactive script files (JavaScript files), style resource files (CSS files), images, and text, need to be obtained from the server in real time through network requests. This can easily lead to slow page loading speeds and long rendering times due to factors such as network latency and bandwidth fluctuations.

[0017] To overcome the aforementioned problems, offline package technology emerged and has been widely adopted. The core idea of ​​offline package technology is to pre-package the static resources required for a web page to run into one or more offline packages, integrating them into the installation package of the hybrid application or downloading them to the user's device in advance for local storage. When a user accesses a web page within the corresponding hybrid application, the client of the hybrid application, through appropriate means such as intercepting WebView's network requests, prioritizes loading the static resources required for the web page to run from the local storage. This significantly improves the loading speed of the web page, reduces dependence on the network environment, and decreases server load and user traffic consumption. Currently, offline package technology has become one of the key technologies for improving the user experience of hybrid applications and is widely used in various mobile applications such as e-commerce, finance, and news.

[0018] like Figure 1 The diagram illustrates the generation sequence of offline packages in a non-splitting scenario. First, the build server packages the source code files corresponding to the web pages in the hybrid application, generating static resource files including page files (HTML files), interactive script files (JavaScript files), style files (CSS files), and static resources. These static resource files are then placed in a shared storage location, and the build server instructs the offline package server to package them. Next, the offline package server downloads the static resource files from the shared storage location and stores them in its local directory. The offline package server checks the packaging configuration file corresponding to the web page (which describes which resources are packaged) and generates one or more offline packages based on the configuration file. Then, the packaged offline packages are pushed to the Content Delivery Network Server (CDN server). Furthermore, the content delivery server pushes the storage link (download link) corresponding to the offline package to the offline package server. Finally, the offline package server pushes configuration information, including the version number and download link of the offline package, to the configuration server. Upon receiving the configuration information, the configuration server updates the current offline package version and download link and publishes it online, so that hybrid application clients can download the offline package locally after opening it.

[0019] To reduce the size of offline packages and improve update efficiency, a combination of "offline package splitting" and "differential updates" is commonly used. Offline package splitting typically involves splitting packages according to fixed modules. For example, during the build phase, developers manually split the static resource files of the entire hybrid application into multiple offline packages based on fixed functional modules (such as "Homepage," "Personal Center," and "Shopping Cart"). Each offline package contains all the static resources required by one or more business modules. However, this static offline package splitting strategy struggles to accurately reflect the actual resource loading status of the hybrid application in a real user environment. Therefore, the splitting results generated by this strategy are often not optimal, potentially resulting in excessively large offline packages containing unnecessary resources, or duplicate dependencies between different offline packages, leading to resource redundancy and diminishing the performance benefits that splitting offline packages should bring. Moreover, as the hybrid application's business iterations and routing structure change, the splitting strategy also needs corresponding adjustments. The aforementioned static offline package splitting strategy cannot automatically adapt to such changes; each business upgrade may require re-evaluation and modification of the splitting configuration, not only adding extra development and testing burdens but also increasing the complexity of long-term maintenance.

[0020] For differential updates, the typical approach is to use adjacent versions to perform incremental updates step by step. For example... Figure 2 As shown, assume the offline package version numbers are V1, V2, V3, and V4. Let the client's currently cached offline package version number be V1, and the latest version number be V4. If the client updates from V1 to V4, the update process must be strictly executed in sequence. First, the client requests the differential package from V1 to V2 from the server, then applies the returned differential package to upgrade to V2. Next, the client requests the differential package from V2 to V3 from the server, then applies the returned differential package to upgrade to V3. Finally, the client requests the differential package from V3 to V4 from the server, then applies the returned differential package to upgrade to V4, thus completing the update from V1 to V4. Therefore, updating adjacent versions sequentially requires the client to download and install the differential package for each version in turn, resulting in a long upgrade path, long processing time, and a high failure rate, especially causing a significant decline in user experience under fluctuating network conditions.

[0021] To overcome the drawback of long link length in the above schemes, a scheme is proposed to generate and store differential packets between any two historical versions on the server side. For example... Figure 3As shown, if a client wants to update from V1 to V4, it can directly request the differential update package from V1 to V4 from the server. The server finds / generates the differential update package from V1 to V4 and then returns it to the client. The client then applies the differential update package from V1 to V4 to upgrade to V4. It is evident that while differential updates between any versions shorten the client's update chain, the number of differential update packages increases exponentially with the number of versions, resulting in extremely high storage and computational costs. This implementation method has a significant bottleneck in system scalability. Even with an upper limit on the number of versions, it is difficult to support the update needs of hybrid applications during long-term, rapid iterations, thus failing to fully leverage the advantages of differential update packages themselves.

[0022] To address the aforementioned issues, this application, based on the static resource files packaged and built by the server, performs a preventative check on the target webpage (the Web page mentioned earlier) to determine the primary static resources required for accessing the Web page. These primary static resources are then placed in the primary offline package for pre-downloading by the client. Other less critical resources are placed in secondary offline packages and downloaded when the Web page is actually accessed. This accurately reflects the actual resource loading status of the Web page in a real user environment. Regarding differential updates, this application introduces the concept of anchor version numbers. The server only calculates and stores the differential packets between each anchor version number, as well as the differential packets between the current anchor version number and the latest version number. This allows the client to quickly upgrade to the latest version number regardless of its current version number, using the anchor version number.

[0023] As an optional application scenario of this invention, such as Figure 4 The diagram shows the architecture of an interactive system. This system includes a build server, an offline package server, a configuration server, a content distribution server, and terminal devices. The build server, offline package server, and configuration server can communicate with the content distribution server via an internal network. The terminal devices have clients installed for hybrid applications, and these clients can communicate with the configuration server and content distribution server via an external network.

[0024] Specifically, terminal devices can be smartphones, tablets, laptops, PDAs, desktop computers, game consoles, smart TVs, smart wearable devices, in-vehicle terminals, VR (Virtual Reality) devices, AR (Augmented Reality) devices, etc. Build servers, offline package servers, configuration servers, and content distribution servers can all be independent physical servers, server clusters, distributed systems, or cloud servers providing cloud services.

[0025] According to an embodiment of the present invention, an embodiment of a method for generating an offline package is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0026] This embodiment provides a method for generating offline packages, which can be used in an offline package server. Figure 5 This is a flowchart of an offline package generation method according to an embodiment of the present invention, such as... Figure 5 As shown, the process includes the following steps: Step S501: Obtain the static resource file of the target webpage to be rendered and the corresponding Uniform Resource Locator (URL). The static resource file is constructed by the build server based on the source code file corresponding to the target webpage.

[0027] The target webpage can be a web page within a hybrid application. The corresponding static resource files for the target webpage can include HTML files, JavaScript files, CSS files, and other static resources. Static resources can include images, text, etc.

[0028] As a concrete example, the build server packages the source code files corresponding to the target webpage to generate static resource files, uploads these static resource files to a shared storage location, and sends a packaging notification to the offline package server. Upon receiving the packaging notification, the offline package server can download the static resource files from the shared storage location and store them locally.

[0029] A Uniform Resource Locator (URL) is a standardized string format used in the Internet domain to uniquely identify and locate network resources. It enables clients such as browsers and applications to accurately access target resources such as web pages and files on the network through clearly defined protocol rules, server addresses, resource paths, and other elements.

[0030] As a concrete example, after obtaining the static resource files of the target webpage, the offline package server can start a local static service to proxy the static resource files, i.e., generate the URL of the static resource files. The target webpage can then be accessed via this URL. For example, the URL of the static resource files can be generated by combining the local domain name of the static service and the local storage path of the static resource files on the offline package server. As a specific example, the local domain name of the static service could be 127.0.0.1.

[0031] Step S502: Pre-access the target webpage based on the Uniform Resource Locator (URL) to generate the main static resource corresponding to the target webpage.

[0032] The main static resources are the static resources required when a user visits the target webpage and displays the target webpage on the first screen (when the user has not scrolled or swiped the target webpage). These include, but are not limited to, CSS files, JavaScript files, images on the first screen, and related text.

[0033] As a concrete example, the browser can pre-access the target webpage based on the Uniform Resource Locator. During the pre-access process, the static resources used by the target webpage to render the first screen are marked, thereby obtaining the main static resources corresponding to the target webpage.

[0034] Step S503: Compress the main static resources and generate the main offline package corresponding to the target webpage.

[0035] The main offline package can be a compressed package obtained by compressing the main static resources. The main offline package can include the main static resources required for rendering the target webpage on the first screen. As a specific example, a compression algorithm can be used to compress the main static resources to obtain the corresponding main offline package. The compression algorithm includes, but is not limited to, lossless compression algorithms and lossy compression algorithms. During the compression of the main static resources, different compression algorithms can be selected based on the specific type of resources within the main static resources. This application does not specifically limit the compression algorithm; the appropriate algorithm can be flexibly selected based on the actual usage.

[0036] The offline package generation method provided in this embodiment pre-accesses the target webpage based on the Uniform Resource Locator (URL) corresponding to the static resource files. This allows for accurate determination of the actual resource loading status of the target webpage in a real user environment, as well as the accurate identification of the main static resources required for the initial display of the target webpage when a user accesses it. By compressing the main static resources to obtain the main offline package, a more accurate differential packaging of the static resource files corresponding to the target webpage is achieved. This avoids situations where the offline package is too large and contains unnecessary static resources, or too small and lacks the static resources required for displaying the initial webpage, thereby solving the problem of long webpage loading times.

[0037] This embodiment provides a method for generating offline packages, which can be used in an offline package server. Figure 6 This is a flowchart of an offline package generation method according to an embodiment of the present invention, such as... Figure 6 As shown, the process includes the following steps: Step S601: Obtain the static resource files of the target webpage to be rendered and the corresponding Uniform Resource Locators (URLs). The static resource files are constructed by the build server based on the source code files corresponding to the target webpage. For details, please refer to [link to relevant documentation]. Figure 5 Step S501 of the illustrated embodiment will not be described again here.

[0038] Step S602: Pre-access the target webpage based on the Uniform Resource Locator (URL) to generate the main static resource corresponding to the target webpage.

[0039] Specifically, step S602 includes: Step S6021: In response to the operation of inputting a Uniform Resource Locator to the target browser, load the target webpage.

[0040] As a concrete example, the target browser can be a headless browser. A headless browser is a web page processing tool that has a graphical user interface (GUI) removed and runs only in the background. A headless browser can parse the HTML file of a web page, execute JavaScript code, render CSS styles, and handle network requests and cookies, but it does not need to display visual elements such as windows or address bars.

[0041] Here, you can input a Uniform Resource Locator (URL) into the target browser. The target browser will parse the URL to load the target webpage corresponding to the URL.

[0042] Step S6022: During the loading of the target webpage, query the static resource files for the target style resource files and target interactive resource files required for loading the target webpage.

[0043] During the loading of the target webpage, it is necessary to call the style resource file (CSS file) to obtain the style of the target webpage and the interactive resource file (JavaScript file) to obtain the interactive resources of the target webpage. In this application, since all the static resource files corresponding to the target webpage are already stored locally, during the loading of the target webpage, the headless browser can forward the requests to load the CSS file and JavaScript file to the static server, thereby querying the target style resource file and target interactive resource file required for loading the target webpage from the local static resource files.

[0044] Step S6023: Obtain style resource information for the target webpage from the target style resource file.

[0045] Here, the style resource information for the target webpage can be obtained by compiling and executing the code in the target style resource file. This style resource information can be used to define the visual appearance, layout rules, and interactive states of the target webpage. For example, style resource information may include, but is not limited to, basic information and layout positioning information. Basic information may include, but is not limited to, color and background, size and margins, font and typography, display and visibility; layout positioning information may include, but is not limited to, positioning methods, grid layout, and floating rules.

[0046] Step S6024: Based on the interface information in the target interactive resource file, obtain the interactive resource information for the target webpage.

[0047] Interface information can be structured information about various programming interfaces that support webpage interaction. These programming interfaces can include network request interfaces, browser built-in application programming interfaces (APIs), front-end internal function interfaces, and third-party library / plugin APIs.

[0048] Interactive resource information can be obtained by accessing external servers, such as content delivery servers, based on interface information in the target interactive resource file. When compiling and executing the code in the target interactive resource file, it typically accesses some Hypertext Transfer Protocol (HTTP) interfaces to obtain interactive resources that can only be obtained through interaction. Headless browsers can forward HTTP requests to these interfaces to the production environment's content delivery server, as shown above, to obtain the interactive resource information. Of course, for interactive resources that can only be accessed by a logged-in account, specific test accounts can be pre-configured when forwarding HTTP requests to obtain the interactive resource information.

[0049] In some optional implementations, step S6024 above includes: Step a1: Based on the interface information in the target interactive resource file, generate an access request for accessing the content distribution server.

[0050] Step a2: Push the access request to the content distribution server.

[0051] Step a3: Receive interactive resource information pushed by the content distribution server in response to the access request.

[0052] The access request generated based on the interface information is pushed to the content distribution server, and the interactive resource information pushed by the content distribution server is received. In this way, the interactive resource information required by the user to access the target webpage in the real environment can be obtained, which ensures that the obtained interactive resource information is relatively accurate, and further ensures that the main static resources are obtained in the future.

[0053] Step S6025: The target style resource file, target interactive resource file, style resource information and interactive resource information are merged to obtain the main static resource.

[0054] This section integrates the target style resource file, target interaction resource file, style resource information, and interaction resource information into a single folder, resulting in a main static resource that contains the target style resource file, target interaction resource file, style resource information, and interaction resource information.

[0055] In addition, once the main static resources are obtained, the headless browser has completed its task of rendering the target webpage. Therefore, the static service can close the headless browser and forward the target style resource file, target interactive resource file, style resource information, and interactive resource information to the offline package server.

[0056] During the loading of the target webpage, the system first queries and marks the target style resource files and target interaction resource files necessary for loading the target webpage from the local static resource files. Then, it uses the target style resource files to obtain the style resource information necessary for loading the target webpage, and uses the target interaction resource files to obtain the interaction resource information necessary for loading the target webpage. In this way, the main static resources necessary for loading the target webpage, namely the first screen static resources, can be obtained more accurately and comprehensively, further ensuring that the obtained main static resources are more reasonable.

[0057] Step S603: Compress the main static resources to generate the main offline package corresponding to the target webpage. For details, please refer to [link to relevant documentation]. Figure 5 Step S503 of the illustrated embodiment will not be described again here.

[0058] In some alternative implementations, the method further includes: Step b1: Push the main offline package to the content distribution server so that the content distribution server can generate the main download link corresponding to the main offline package.

[0059] Step b2: Generate first configuration information based on the main download link pushed by the content distribution server, and push the first configuration information to the configuration server. The first configuration information is used to download the main offline package.

[0060] Here, the offline package server can push the main offline package to the content distribution server, and generate the first configuration information based on the main download link and version number of the main offline package pushed by the content distribution server. The first configuration information is then pushed to the configuration server. Subsequently, the configuration server can push the first configuration information to the client when the client starts up. In this way, the client can download the main offline package from the content distribution server based on the main download link in the first configuration information, so as to achieve the purpose of downloading the main offline package to the client's local machine in advance.

[0061] The offline package server pushes the main offline package to the content distribution server for storage and pushes the first configuration information for the main offline package to the configuration server, thereby decoupling the storage of the main offline package from its corresponding first configuration information and reducing the access pressure on the configuration server or the content distribution server.

[0062] In some alternative implementations, the method further includes: Step c1: Compress the static resources in the static resource file, excluding the main static resources, to generate the sub-offline package corresponding to the target webpage.

[0063] Step c2 involves pushing the sub-offline package to the content distribution server, so that the content distribution server generates a sub-download link corresponding to the sub-offline package.

[0064] Step c3: Generate second configuration information based on the sub-download link pushed by the content distribution server, and push the second configuration information to the configuration server. The second configuration information is used to download the sub-offline package.

[0065] A sub-offline package can be a compressed package obtained by compressing other static resources in a static resource file besides the main static resource file. The sub-offline package may include other static resources required for rendering the target webpage that is not the first screen. Furthermore, it should be understood that the main offline package and the sub-offline package can constitute a complete offline package, which can be an offline package obtained by compressing the static resource files of the target webpage.

[0066] As a concrete example, based on the business modules shown above or the pre-defined splitting rules, other static resources besides the main static resources can be further split to reduce the size of the sub-offline packages, improve the download speed of the sub-offline packages, and improve the loading speed of the target webpage.

[0067] All static resources other than the main static resources are compressed into sub-offline packages. The offline package server pushes the sub-offline packages to the content distribution server for storage, and pushes the corresponding second configuration information of the sub-offline packages to the configuration server. This lays the foundation for subsequent differential updates.

[0068] The offline package generation method provided in this embodiment, by loading the target webpage using the target browser, can obtain the main static resources required to reflect the actual clicks on the target webpage by the user. This avoids situations where the main offline package is too large and contains unnecessary resources; it also avoids situations where the main offline package lacks the static resources required to render the target webpage's first screen. This achieves better splitting of the static resource files corresponding to the target webpage, thereby improving the loading speed of the target webpage. Simultaneously, storing the main offline package and sub-offline packages on a content distribution server, and storing the first configuration information corresponding to the main offline package and the second configuration information corresponding to the sub-offline packages on a configuration server, decouples the offline package from the configuration information in terms of storage, reducing the access pressure on the configuration server or content distribution server.

[0069] As a specific example, such as Figure 7 The diagram shown illustrates the timing of a specific offline package generation method. This process may include steps S701 to S711. Wherein, In step S701, the build server packages the source code files corresponding to the target webpage in the hybrid application to obtain static resource files, which include page files (HTML files), interactive script files (JavaScript files), style files (CSS files), and static resources. The static resource files are placed in a shared storage location, and the build server notifies the offline package server to package the static resource files.

[0070] In step S702, after receiving the notification from the build server, the offline package server downloads the static resource files from the shared storage location and stores the static resource files locally.

[0071] In step S703, after the offline package server downloads and stores the static resource files locally, it starts the local static service, proxies the static resource files, and generates a Uniform Resource Locator (URL) for the static resource files, so that the target webpage can be accessed through the URL.

[0072] Step S704: The offline package server starts the headless browser, enabling the headless browser to access the target webpage through the URL of the static resource file.

[0073] In step S705, after the static service returns the target webpage to the headless browser, the headless browser parses and loads the target webpage.

[0074] In step S706, during the loading of the target webpage, the headless browser accesses resources from a static server. For example, the headless browser loads Javascript and CSS files, forwarding the requests to these files to the static server. The static server then returns the local target Javascript and CSS files to the headless browser. The headless browser obtains style resource information by executing and compiling the code in the target CSS file.

[0075] In step S707, the headless browser compiles and executes the code in the JavaScript file. Based on some HTTP interfaces that the target webpage will access, the headless browser generates access requests and forwards the access requests to the real online environment, such as online interface services and content distribution servers, and obtains real interactive resource information with a pre-configured specific test account.

[0076] In step S708, the headless browser records the main static resources, including the target JavaScript file, the target CSS file, style resource information, and interactive resource information.

[0077] In step S709, the headless browser returns the main static resources to the offline package server. The offline package server compresses the main static resources to obtain the main offline package, and compresses the other static resources in the static resource files besides the main static resources to obtain the sub-offline packages.

[0078] In step S710, the offline package server pushes the main offline package and the sub-offline package to the content distribution server. The content distribution server then returns the main download link for the main offline package and the sub-download link for the sub-offline package to the offline package server.

[0079] In step S711, the offline package server generates first configuration information for the main offline package based on the main download link and the version number of the main offline package; and generates second configuration information for the sub-offline package based on the sub-download link and the version number of the sub-offline package. The first and second configuration information are pushed to the configuration server, which updates the current offline package version and download link and publishes it online so that it can be updated when the client opens it.

[0080] This embodiment provides a webpage rendering method that can be used on terminal devices with clients for hybrid applications deployed on them. Figure 8 This is a flowchart of a webpage rendering method according to an embodiment of the present invention, such as... Figure 8 As shown, the process includes the following steps: Step S801: In response to the client's start operation, obtain the main offline package corresponding to the target webpage. The main offline package is obtained by compressing the main static resources. The main static resources are generated by pre-accessing the target webpage based on the Uniform Resource Locator corresponding to the static resource file. The static resource file is built by the build server based on the source code file corresponding to the target webpage.

[0081] Here, the client can obtain the main offline package corresponding to the target webpage from either the offline package server or the content delivery server when the client is launched, thus pre-downloading the main offline package to the local machine. Alternatively, the client can download the main offline package to the local machine when the user launches the client and enters the target webpage. This way, when the user visits the target webpage a second time, the resources needed to render the target webpage can be directly obtained from the local machine.

[0082] Specifically, step S801 includes: Step S8011: In response to the request operation for configuration information of the target webpage, obtain the first configuration information corresponding to the target webpage from the configuration server.

[0083] As a concrete example, when the client starts up, it can send a request to the configuration server to obtain the configuration information corresponding to the latest version of the main offline package, i.e., the first configuration information. The configuration server responds to the client's request and pushes the first configuration information to the client. Accordingly, the client can receive the first configuration information pushed by the configuration server.

[0084] Step S8012: Based on the main download link carried in the first configuration information, access the content distribution server and download the main offline package corresponding to the main download link from the content distribution server.

[0085] As mentioned above, the first configuration information includes the main download link corresponding to the main offline package. Therefore, the client can access the content distribution server through the main download link, thereby downloading the main offline package corresponding to the main download link from the content distribution server.

[0086] The client downloads the main offline package from the content distribution server based on the main download link pushed by the configuration server. This decouples the storage of the main offline package and the corresponding first configuration information, reducing the access pressure on the configuration server and the content distribution server.

[0087] Step S802: Render the target webpage based on the main static resources corresponding to the main offline package.

[0088] When a user launches the client and accesses the target webpage, the client can match the target webpage based on its page path. Once the corresponding main offline package is matched, the client can directly use the cached resources stored locally in the main offline package without requesting resources from the main offline package over the network. This reduces network requirements and minimizes the waste of network traffic.

[0089] When the client starts, the main offline package is extracted and obtained. When the user accesses the target webpage, the target webpage is rendered based on the main static resources in the main offline package. This can reduce the network requirements of the user when using the client and improve the loading speed of the target webpage, thereby improving the user experience.

[0090] In some alternative implementations, the method includes: Step d1: In response to the trigger operation for the target webpage, obtain the second configuration information corresponding to the target webpage from the configuration server.

[0091] Step d2: Based on the sub-download link carried in the second configuration information, access the content distribution server and download the sub-offline package from the content distribution server.

[0092] Step d3: Render the target webpage based on other static resources corresponding to the sub-offline package.

[0093] This can occur when a user further triggers the target webpage via a terminal device. For example, a user can swipe across the target webpage by sliding their terminal device screen. In response to the user's trigger action, the terminal device sends a request to the configuration server to retrieve second configuration information. The configuration server responds to the client's request by pushing the second configuration information to the client. Accordingly, the client can then receive the second configuration information pushed by the configuration server.

[0094] As mentioned above, the second configuration information includes the sub-download link corresponding to the sub-offline package. Therefore, the client can access the content distribution server through the sub-download link to download the sub-offline package corresponding to the sub-download link from the content distribution server.

[0095] When a user makes further access to the target webpage, the sub-offline package is downloaded from the content delivery server based on the sub-download link in the second configuration information. This enables on-demand downloading of the sub-offline package, rather than downloading it locally in advance, thus saving local disk resources.

[0096] The webpage rendering method provided in this embodiment downloads the main offline package from the content distribution server in advance based on the main download link when the client starts. When accessing the target webpage, the main offline package is used to render the target webpage, and the sub-offline package is downloaded from the content distribution server based on the sub-download link, realizing the on-demand download of the sub-offline package. This not only enables faster loading of the target webpage, but also saves the corresponding local resources of the client, further improving the user experience.

[0097] As a specific example, such as Figure 9 The diagram shown illustrates the timing of the client downloading the main offline package and the sub-offline package, specifically including steps S901 to S905. Among these steps... In step S901, when the client is started (i.e., when the APP is started), the client sends a request to the configuration server to obtain the first configuration information, and the configuration server returns the first configuration information to the client.

[0098] In step S902, the client downloads the main offline package from the content distribution server based on the main download link in the first configuration information, and the content distribution server returns the main offline package to the client.

[0099] Step S903: When accessing the target webpage in the client, the main offline package is matched according to the page path corresponding to the target webpage. After the main offline package is matched, the cached resources of the main offline package in the local machine are used to render the target webpage.

[0100] In step S904, the client sends a request to the configuration server to obtain the second configuration information, and the configuration server returns the second configuration information to the client.

[0101] In step S905, the client downloads the sub-offline package from the content delivery server based on the sub-download link in the second configuration information, and the content delivery server returns the sub-offline package to the client. The client caches the sub-offline package and uses it to render the target webpage.

[0102] This embodiment provides a method for generating offline packages, which can be used in an offline package server. Figure 10 This is a flowchart of an offline package generation method according to an embodiment of the present invention, such as... Figure 10 As shown, the process includes the following steps: Step S1001: Obtain the current anchor version number, the new offline package, and the latest version number of the new offline package.

[0103] Upon initial installation and startup of the client, the main offline package corresponding to the client version number will be downloaded in advance, along with sub-offline packages as needed. Subsequently, if the target webpage in the client is updated, the offline package splitting method described earlier can be used to split and package the static resource files corresponding to the updated target webpage, resulting in a new version of the main offline package and a new version of the sub-offline package. That is, when the new offline package is a new main offline package, its version number is higher than the version number of the main offline package shown earlier; when the new offline package is a new sub-offline package, its version number is higher than the version number of the sub-offline package shown earlier.

[0104] After the new version of the main offline package and the new version of the sub-offline package (hereinafter referred to as the new offline package) are released online, the main offline package can be differentially updated locally on the client when it starts up, and the sub-offline package can be differentially updated locally on the client when accessing the target webpage. That is, the main offline package can be differentially updated in advance, and the sub-offline package can be differentially updated as needed. The latest version number can be the version number corresponding to the new offline package.

[0105] Here, the current anchor version number can be the version number that is most recently updated and has a special marker. For example, if the offline package version numbers include V1, V2, V3, V4, V5, V6, and V7, and V1 and V6 are set as anchor version numbers, then V7 can be the latest version number of the new offline package. In this case, V6 becomes the current anchor version number, and V1 becomes the historical anchor version number.

[0106] Step S1002: Based on the fusion result of the preset version number interval and the current anchor version number, determine whether the latest version number of the new offline package is the latest anchor version number.

[0107] The preset version number interval can be a pre-set version number interval. As a specific example, the preset version number interval can be 5. Of course, the preset version number interval is not limited to 5, and can be other specific values. This application does not make any specific limitation on this.

[0108] Here, the anchor version numbers in the offline package can be determined sequentially by using the version number interval and the reference anchor version number. For example, if the preset version number interval is 5, and V1 is set as the reference anchor version number, which is also the initial anchor version number, then it can be deduced that V6 and V11 are anchor version numbers, and so on.

[0109] Here, the preset version number interval can be added to the current anchor version number to obtain the latest anchor version number; then, it is determined whether the latest version number is the same as the latest anchor version number; if the latest version number is the same as the latest anchor version number, then the latest version number of the new offline package is determined to be the latest anchor version number; if the latest version number is different from the latest anchor version number, then the latest version number of the new offline package is determined not to be the latest anchor version number.

[0110] Step S1003: If the latest version number is the latest anchor version number, then determine the first differential packet between the new offline package and the historical anchor offline packages corresponding to each historical anchor version number, and the second differential packet between the new offline package and the current anchor offline package corresponding to the current anchor version number.

[0111] A differential packet, also known as an incremental packet or patch packet, is a data package generated by comparing a new version file (e.g., version B) with an older version file (e.g., version A) using a differential algorithm. It contains only information about the differences between the two versions, and its size is much smaller than the complete new version file (e.g., B). The differential algorithm can be used to calculate the differences between two files or datasets (old and new versions). As a specific example, differential algorithms can be, but are not limited to, binary differential (BSDiff), high-performance differential (HDiff), etc.

[0112] As a specific example, a differential algorithm can be used to calculate the first differential packet between the new offline package and the historical anchor offline packages corresponding to each historical anchor version number, and the second differential packet between the new offline package and the current anchor offline package corresponding to the current anchor version number.

[0113] This section calculates the first difference packet between the new offline package and the corresponding historical anchor offline packages for each historical anchor version number. Subsequently, regardless of which historical anchor version number the client's local offline package belongs to, it can be upgraded using the first difference packet between the historical anchor version number and the new offline package. It also calculates the second difference packet between the new offline package and the current anchor offline package corresponding to the current anchor version number. Subsequently, if the version number of the client's local offline package is the current anchor version number, it can be upgraded using the second difference packet.

[0114] Step S1004: If the latest version number is not the latest anchor version number, then determine the third differential package between the new offline package and the current anchor offline package; wherein, the package types of the historical anchor offline package, the current anchor offline package, and the new offline package are the same.

[0115] When the latest version number of the new offline package is not the latest anchor version number, it is only necessary to calculate the third difference package between the new offline package and the current anchor offline package. This way, when upgrading the offline package locally on the client, it can first be upgraded to the offline package corresponding to the current anchor version number, and then, using the third difference package, upgraded from the offline package corresponding to the current anchor version number to the new offline package. In this way, it can be updated to the new offline package in a maximum of two upgrade operations.

[0116] In some alternative implementations, the method further includes: Step e1: Push the first differential package and the second differential package to the content distribution server so that the content distribution server generates a first download link corresponding to the first differential package and a second download link corresponding to the second differential package.

[0117] Step e2: Based on the first differential version number of the first differential package and the first download link pushed by the content distribution server, a first mapping relationship is constructed, and the first mapping relationship is pushed to the configuration server so that the configuration server generates a first configuration file based on the first mapping relationship and distributes the first configuration file to the client.

[0118] Step e3: Based on the second differential version number of the second differential package and the second download link pushed by the content distribution server, a second mapping relationship is constructed, and the second mapping relationship is pushed to the configuration server so that the configuration server generates a second configuration file based on the second mapping relationship and distributes the second configuration file to the client.

[0119] Step f1 involves pushing the third differential package to the content distribution server so that the content distribution server generates a third download link corresponding to the third differential package.

[0120] Step f2: Construct a third mapping relationship based on the third differential version number of the third differential package and the third download link pushed by the content distribution server.

[0121] Step f3 pushes the third mapping relationship to the configuration server, so that the configuration server generates a third configuration file based on the third mapping relationship and distributes the third configuration file to the client.

[0122] The differential version number here serves as a unique identifier for the version relationship corresponding to the differential package. The differential version number typically contains information about the old version number and the new version number. For example, if V1 is set as the old version number and V4 is the latest version number, and the differential package is a differential package between versions V1 and V4, then the differential version number of the differential package can be V1-V4.

[0123] The mapping relationship between the differential version number and the download link is pushed to the configuration server, and the configuration server generates a configuration file which is then downloaded to the client. In this way, the client can download the corresponding differential package from the content distribution server with the help of the mapping relationship, knowing the old and new version numbers, so that the client can update the version in a timely manner.

[0124] The offline package generation method provided in this embodiment calculates differential packages based on whether the latest version number of the new offline package is the latest anchor version number. If it is the latest anchor version number, then the first and second differential packages are calculated; if it is not the latest anchor version number, then the third differential package is calculated. In this way, the offline package server only calculates and the content distribution server only stores differential packages between anchor version numbers and between the current anchor version number and the latest version number, which avoids the problem of the number of differential packages increasing exponentially with the number of versions.

[0125] As one specific embodiment, such as Figure 11 The diagram shown illustrates the timing of the offline package server generating differential packets, specifically including steps S1101 to S1105. In step S1101, the version control system can push a new version release notification to the offline package server. When the offline package server receives the notification, it determines whether the latest version number of the new offline package should be set to the latest anchor version number.

[0126] Step S1102: If the latest version number is the latest anchor version number, then find the historical anchor offline package corresponding to each historical anchor version number and the current anchor offline package corresponding to the current anchor version number, and use the differential calculation system to calculate the first differential package between each historical anchor offline package and the new offline package; and the second differential package between the current anchor offline package and the new offline package.

[0127] Step S1103: If the latest version number is not the latest anchor version number, then the differential calculation system is used to calculate only the third differential packet between the current anchor offline packet and the new offline packet.

[0128] Step S1104: Push the calculated first differential packet, second differential packet, or third differential packet to the content distribution server.

[0129] Step S1105: Generate a first mapping relationship based on the first download link corresponding to the first differential package pushed by the content distribution server and the first differential version number corresponding to the first differential package; and generate a second mapping relationship based on the second download link corresponding to the second differential package pushed by the content distribution server and the second differential version number corresponding to the second differential package; or, generate a third mapping relationship based on the third download link corresponding to the third differential package pushed by the content distribution server and the third differential version number corresponding to the third differential package, and push the first mapping relationship and the second mapping relationship, or the third mapping relationship, to the configuration server, so that the configuration server generates a first configuration file based on the first mapping relationship and a second configuration file based on the second mapping relationship, or generates a third configuration file based on the third mapping relationship, and distributes the first configuration file and the second configuration file, or the third configuration file, to the client.

[0130] This embodiment provides a webpage rendering method that can be used on terminal devices with clients for hybrid applications deployed on them. Figure 12 This is a flowchart of an offline package generation method according to an embodiment of the present invention, such as... Figure 12 As shown, the process includes the following steps: Step S1201: Receive the latest version number of the new offline package pushed by the configuration server and the second configuration file.

[0131] As mentioned earlier, the configuration server stores the configuration information for the new offline package (including the latest version number of the new offline package and the download link for the new offline package on the content distribution server). Therefore, the configuration server can push this configuration information to the client, and the client can use this configuration information to obtain the latest version number of the new offline package. It should be understood that the new offline package can be the latest offline package corresponding to the target webpage.

[0132] Step S1202: Determine whether the version number of the local offline package is the current anchor version number, and whether the latest version number is the latest anchor version number.

[0133] The local offline package can be a package that has already been downloaded to the client and is the latest version available on the client's local machine. By determining whether the version number of the local offline package matches the current anchor version number, and whether the latest version number of the new offline package matches the latest anchor version number, the strategy for upgrading the local offline package to the new offline package can be determined.

[0134] Step S1203: If the version number of the local offline package is the current anchor version number and the latest version number is the latest anchor version number, then query the second download link corresponding to the second differential package from the second configuration file.

[0135] If the version number of the local offline package is the current anchor version number and the latest version number is the latest anchor version number, it means that it can be directly upgraded from the current anchor version number to the latest anchor version number. Therefore, the second download link corresponding to the second differential package between the current anchor offline package and the new offline package can be queried with the help of the second configuration file.

[0136] Step S1204: Download the second differential package from the content distribution server based on the second download link.

[0137] The content delivery server responds to the client's download operation by pushing the second differential packet to the client.

[0138] Step S1205: Based on the fusion result of the local offline package and the second differential package, update the local offline package to the new offline package; wherein, the second configuration file is used to store the second download link corresponding to the second differential package, the second differential package is the differential package between the new offline package and the current anchor offline package corresponding to the current anchor version number, and the local offline package, the current anchor offline package and the new offline package have the same package type.

[0139] It should be understood that the local offline package, the current anchor offline package, and the new offline package have the same package type, that is, the local offline package, the current anchor offline package, and the new offline package are all main offline packages, or all are sub-offline packages.

[0140] In some alternative implementations, the method further includes: Step g1: Receive the third configuration file pushed by the configuration server.

[0141] Step g2: If the version number of the local offline package is the current anchor version number and the latest version number is not the latest anchor version number, then query the third download link corresponding to the third differential package from the third configuration file.

[0142] Step g3: Download the third differential package from the content distribution server based on the third download link.

[0143] Step g4: Based on the fusion result of the local offline package and the third differential package, update the local offline package to the new offline package; wherein, the third configuration file is used to store the third download link corresponding to the third differential package, and the third differential package is the differential package between the new offline package and the current anchor offline package corresponding to the current anchor version number, and the local offline package, the current anchor offline package and the new offline package have the same package type.

[0144] If the version number of the local offline package is the current anchor version number and the latest version number is not the latest anchor version number, it means that the local offline package can be directly upgraded to the new offline package through the third differential package between the current anchor version number and the latest version number. In this way, the local offline package can be updated in one merge operation, thereby reducing the number of differential package downloads and shortening the update path of the offline package.

[0145] In some alternative implementations, the method further includes: Step h1: Receive the first configuration file pushed by the configuration server.

[0146] Step h2: If the version number of the local offline package is the historical anchor version number and the latest version number is the latest anchor version number, then query the first download link corresponding to the first differential package from the first configuration file.

[0147] Step h3: Download the first differential package from the content distribution server based on the first download link.

[0148] Step h4: Based on the fusion result of the local offline package and the first differential package, update the local offline package to the new offline package; wherein, the first configuration file is used to store the first download link corresponding to the first differential package, the first differential package is the differential package between the new offline package and the historical anchor offline package corresponding to the historical anchor version number, and the local offline package, the historical anchor offline package and the new offline package have the same package type.

[0149] If the version number of the local offline package is the historical anchor version number and the latest version number is the latest anchor version number, it means that the local offline package can be directly upgraded to the new offline package through the first differential package between the historical anchor version number and the latest anchor version number. In this way, the local offline package can be updated in one merge operation, thereby reducing the number of differential package downloads and shortening the update path of the offline package.

[0150] In some alternative implementations, the method further includes: Step i1: Receive the fourth configuration file pushed by the configuration server.

[0151] Step i2: If the version number of the local offline package is a historical anchor version number and the latest version number is not the latest anchor version number, then query the fourth download link corresponding to the fourth differential package from the fourth configuration file.

[0152] Step i3: Download the fourth differential package from the content distribution server based on the fourth download link.

[0153] Step i4: Based on the fusion result between the local offline package, the fourth differential package, and the third differential package, update the local offline package to the new offline package; wherein, the fourth configuration file is used to store the fourth download link of the fourth differential package, and the fourth differential package is the differential package between the current anchor offline package and the historical anchor offline package corresponding to the historical anchor version number.

[0154] If the version number of the local offline package is a historical anchor version number and the latest version number is not the latest anchor version number, it means that the local offline package needs to be upgraded to the current anchor version number first, and then upgraded from the current anchor version number to the latest version number. Therefore, the fourth differential package between the current anchor offline package and the historical anchor offline package corresponding to the historical anchor version number can be used to upgrade the local offline package to the current anchor offline package, and then the third differential package can be used to upgrade the current anchor offline package to the new offline package. In this way, the local offline package can be quickly updated through two merge operations.

[0155] In some alternative implementations, the method further includes: Step j1: If the version number of the local offline package is not the anchor version number and the latest version number is not the latest anchor version number, then obtain the fifth download link corresponding to the current anchor offline package from the configuration server.

[0156] Step j2: Based on the fifth download link, download the current anchor offline package from the content distribution server.

[0157] Step j3: Based on the fusion result of the current anchor offline package and the third differential package, update the local offline package to the new offline package, wherein the current anchor offline package and the new offline package have the same package type.

[0158] If the version number of the local offline package is not the anchor version number and the latest version number is not the latest anchor version number, it means that upgrading cannot be performed using the anchor version number. Based on this, this application proposes to first download the complete current anchor offline package, and then use a third differential package to upgrade the current anchor offline package to the new offline package, thus achieving a fast update of the local offline package through two merging operations.

[0159] The webpage rendering method provided in this embodiment can accurately determine the strategy for upgrading from a local offline package to a new offline package by determining whether the version number of the local offline package is the current anchor version number and whether the latest version number of the new offline package is the latest anchor version number, thereby enabling a quick upgrade from the local offline package to the new offline package.

[0160] As a specific example, such as Figure 13 The diagram shown is a differential update sequence diagram for upgrading the local offline package on the client to the new offline package, specifically including steps S1301 to S1308.

[0161] In step S1301, upon client startup, the client requests configuration information and anchor version information corresponding to the new offline package from the configuration server. The configuration server returns the configuration information and anchor version information of the new offline package to the client.

[0162] In step S1302, the client checks whether the version number of the local offline package in the local cache is the current anchor version number, and the local cache returns the check result to the client.

[0163] In step S1303, if scenario 1 applies, i.e., the version number of the local offline package is the current anchor version number, and the latest version number of the new offline package is the latest key anchor version number, the client downloads the second differential package from the content delivery server, and the differential merging engine in the client performs one merging operation based on the second differential package returned by the content delivery server and the local offline package, updating the local offline package to the new offline package. The differential merging engine returns an update completion message to the client.

[0164] In step S1304, if it is case 2, that is, the version number of the local offline package is the historical anchor version number and the latest version number is not the latest anchor version number, then the client downloads the fourth differential package (the differential package between the historical anchor offline package corresponding to the historical anchor version number and the current anchor offline package corresponding to the current anchor version number) and the third differential package (the differential package between the current anchor offline package corresponding to the current anchor version number and the new offline package) from the content distribution server. The differential merging engine in the client updates the local offline package to the current anchor offline package based on the fourth differential package, and updates the current anchor offline package to the new offline package with the help of the third differential package, thereby completing the update by performing two merging operations.

[0165] In step S1305, if it is case 3, that is, the version number of the local offline package is not the anchor version number and the latest version number is not the latest anchor version number, the client downloads the current anchor offline package corresponding to the current anchor version number from the content distribution server and downloads the third differential package. The differential merging engine in the client uses the third differential package to update the current anchor offline package to the new offline package.

[0166] In step S1306, the client's local cache retains the current anchor offline package as the anchor version for subsequent updates.

[0167] Through the above process, this application achieves efficient cross-version differential updates with controllable resource overhead, significantly improving the update performance and user experience of the offline package system.

[0168] This embodiment also provides an offline package generation apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0169] This embodiment provides an offline package generation device, such as... Figure 14 As shown, it includes: a first acquisition module 1401, used to acquire the static resource files of the target webpage to be rendered and the corresponding Uniform Resource Locators (URLs) of the static resource files, wherein the static resource files are constructed by the build server based on the source code files corresponding to the target webpage; a first generation module 1402, used to pre-access the target webpage based on the URL and generate the main static resources corresponding to the target webpage; and a first compression module 1403, used to compress the main static resources and generate the main offline package corresponding to the target webpage.

[0170] In some optional implementations, the first generation module 1402 is further configured to load a target webpage in response to an operation of inputting a Uniform Resource Locator (URL) into the target browser; during the loading of the target webpage, query the static resource files for the target style resource file and the target interaction resource file required for preloading the target webpage; obtain style resource information for the target webpage from the target style resource file; obtain interaction resource information for the target webpage based on the interface information in the target interaction resource file; and fuse the target style resource file, the target interaction resource file, the style resource information, and the interaction resource information to obtain the main static resource.

[0171] In some optional implementations, the first generation module 1402 is further configured to generate an access request for accessing the content distribution server based on the interface information in the target interactive resource file; push the access request to the content distribution server; and receive interactive resource information for the access request pushed by the content distribution server.

[0172] In some optional embodiments, the device further includes: a first push module, configured to push the main offline package to a content distribution server, so that the content distribution server generates a main download link corresponding to the main offline package; and a second generation module, configured to generate first configuration information based on the main download link pushed by the content distribution server, and push the first configuration information to a configuration server, wherein the first configuration information is used to download the main offline package.

[0173] In some optional embodiments, the device further includes: a second compression module for compressing other static resources in the static resource file besides the main static resource to generate a sub-offline package corresponding to the target webpage; a second push module for pushing the sub-offline package to a content distribution server so that the content distribution server generates a sub-download link corresponding to the sub-offline package; and a third generation module for generating second configuration information based on the sub-download link pushed by the content distribution server and pushing the second configuration information to a configuration server, wherein the second configuration information is used to download the sub-offline package.

[0174] In some optional embodiments, the device further includes: a second acquisition module, configured to acquire the current anchor version number, the new offline package, and the latest version number of the new offline package; a first fusion module, configured to determine whether the latest version number of the new offline package is the latest anchor version number based on the fusion result of a preset version number interval and the current anchor version number; a first determination module, configured to determine, if the latest version number is the latest anchor version number, a first difference packet between the new offline package and the historical anchor offline packages corresponding to each historical anchor version number, and a second difference packet between the new offline package and the current anchor offline package corresponding to the current anchor version number; and a second determination module, configured to determine, if the latest version number is not the latest anchor version number, a third difference packet between the new offline package and the current anchor offline package; wherein the historical anchor offline packages, the current anchor offline packages, and the new offline packages have the same package type.

[0175] In some optional embodiments, the device further includes: a third push module, configured to push a first differential package and a second differential package to a content distribution server, so that the content distribution server generates a first download link corresponding to the first differential package and a second download link corresponding to the second differential package; a first construction module, configured to construct a first mapping relationship based on the first differential version number of the first differential package and the first download link pushed by the content distribution server, and push the first mapping relationship to a configuration server, so that the configuration server generates a first configuration file based on the first mapping relationship and sends the first configuration file to the client; and a second construction module, configured to construct a second mapping relationship based on the second differential version number of the second differential package and the second download link pushed by the content distribution server, and push the second mapping relationship to the configuration server, so that the configuration server generates a second configuration file based on the second mapping relationship and sends the second configuration file to the client.

[0176] In some optional embodiments, the device further includes: a fourth push module for pushing the third differential package to a content distribution server, so that the content distribution server generates a third download link corresponding to the third differential package; a third construction module for constructing a third mapping relationship based on the third differential version number of the third differential package and the third download link pushed by the content distribution server; and a fifth push module for pushing the third mapping relationship to a configuration server, so that the configuration server generates a third configuration file based on the third mapping relationship and distributes the third configuration file to the client.

[0177] This embodiment provides a webpage rendering device, such as... Figure 15 As shown, it includes: a third acquisition module 1501, used to acquire the main offline package corresponding to the target webpage in response to the client's opening operation. The main offline package is obtained by compressing the main static resources. The main static resources are generated by pre-accessing the target webpage based on the Uniform Resource Locator (URL) corresponding to the static resource file. The static resource file is constructed by the build server based on the source code file corresponding to the target webpage. A first rendering module 1502 is used to render the target webpage based on the main static resources corresponding to the main offline package.

[0178] In some optional implementations, the third acquisition module 1501 is further configured to, in response to a request operation for configuration information of the target webpage, acquire the first configuration information corresponding to the target webpage from the configuration server; and, based on the main download link carried by the first configuration information, access the content distribution server and download the main offline package corresponding to the main download link from the content distribution server.

[0179] In some optional embodiments, the apparatus further includes: a fourth acquisition module, configured to acquire second configuration information corresponding to the target webpage from a configuration server in response to a trigger operation for the target webpage; a first access module, configured to access a content distribution server based on the sub-download link carried in the second configuration information, and download a sub-offline package from the content distribution server; and a second rendering module, configured to render the target webpage based on other static resources corresponding to the sub-offline package.

[0180] In some optional embodiments, the device further includes: a first receiving module, configured to receive the latest version number of the new offline package pushed by the configuration server and a second configuration file; a third determining module, configured to determine whether the version number of the local offline package is the current anchor version number and whether the latest version number is the latest anchor version number; a first query module, configured to query the second download link corresponding to the second differential package from the second configuration file if the version number of the local offline package is the current anchor version number and the latest version number is the latest anchor version number; a first download module, configured to download the second differential package from the content distribution server based on the second download link; and a second fusion module, configured to update the local offline package to the new offline package based on the fusion result of the local offline package and the second differential package; wherein the second configuration file is used to store the second download link corresponding to the second differential package, the second differential package is the differential package between the new offline package and the current anchor offline package corresponding to the current anchor version number, and the local offline package, the current anchor offline package and the new offline package have the same package type.

[0181] In some optional embodiments, the device further includes: a second receiving module for receiving a third configuration file pushed by a configuration server; a second query module for querying a third download link corresponding to the third differential package from the third configuration file if the version number of the local offline package is the current anchor version number and the latest version number is not the latest anchor version number; a second download module for downloading the third differential package from the content distribution server based on the third download link; and a third fusion module for updating the local offline package to a new offline package based on the fusion result of the local offline package and the third differential package; wherein the third configuration file is used to store the third download link corresponding to the third differential package, the third differential package is the differential package between the new offline package and the current anchor offline package corresponding to the current anchor version number, and the local offline package, the current anchor offline package, and the new offline package have the same package type.

[0182] In some optional embodiments, the device further includes: a third receiving module for receiving a first configuration file pushed by a configuration server; a third query module for querying a first download link corresponding to the first differential package from the first configuration file if the version number of the local offline package is a historical anchor version number and the latest version number is the latest anchor version number; a third download module for downloading the first differential package from a content distribution server based on the first download link; and a fourth fusion module for updating the local offline package to a new offline package based on the fusion result of the local offline package and the first differential package; wherein the first configuration file is used to store the first download link corresponding to the first differential package, the first differential package is a differential package between the new offline package and the historical anchor offline package corresponding to the historical anchor version number, and the local offline package, the historical anchor offline package, and the new offline package have the same package type.

[0183] In some optional embodiments, the device further includes: a fourth receiving module for receiving a fourth configuration file pushed by a configuration server; a fourth query module for querying a fourth download link corresponding to the fourth differential package from the fourth configuration file if the version number of the local offline package is a historical anchor version number and the latest version number is not the latest anchor version number; a fourth download module for downloading the fourth differential package from the content distribution server based on the fourth download link; and a fifth fusion module for updating the local offline package to a new offline package based on the fusion result between the local offline package, the fourth differential package, and the third differential package; wherein the fourth configuration file is used to store the fourth download link of the fourth differential package, and the fourth differential package is the differential package between the current anchor offline package and the historical anchor offline package corresponding to the historical anchor version number.

[0184] In some optional embodiments, the device further includes: a fifth acquisition module, configured to acquire a fifth download link corresponding to the current anchor offline package from a configuration server if the version number of the local offline package is not the anchor version number and the latest version number is not the latest anchor version number; a fifth download module, configured to download the current anchor offline package from a content distribution server based on the fifth download link; and a sixth fusion module, configured to update the local offline package to a new offline package based on the fusion result of the current anchor offline package and the third differential package, wherein the current anchor offline package and the new offline package have the same package type.

[0185] The offline package generation apparatus provided in this embodiment of the invention can execute the offline package generation method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.

[0186] Figure 16 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. The electronic device can be the build server, offline package server, content distribution server, configuration server, and terminal device shown above.

[0187] The following is a detailed reference. Figure 16 The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 1601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1602 or a program loaded from memory 1608 into random access memory (RAM) 1603. The RAM 1603 also stores various programs and data required for the operation of the electronic device. The processor 1601, ROM 1602, and RAM 1603 are interconnected via a bus 1604. An input / output (I / O) interface 1605 is also connected to the bus 1604.

[0188] Typically, the following devices can be connected to the I / O interface 1605: input devices 1606 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 1607 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; memory devices 1608 including, for example, magnetic tape, hard disk, etc.; and communication devices 1609. Communication device 1609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 16 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0189] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 1609, or installed from a memory 1608, or installed from a ROM 1602. When the computer program is executed by the processor 1601, it performs the functions defined in the offline package generation method of the embodiments of the present invention.

[0190] Figure 16 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0191] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the offline package generation method shown in the above embodiments is implemented.

[0192] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0193] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method for generating an offline package, characterized in that, The method includes: Obtain the static resource file of the target webpage to be rendered and the Uniform Resource Locator (URL) corresponding to the static resource file. The static resource file is constructed by the build server based on the source code file corresponding to the target webpage. Based on the Uniform Resource Locator, the target webpage is pre-accessed to generate the main static resource corresponding to the target webpage; The main static resources are compressed to generate the main offline package corresponding to the target webpage.

2. The method according to claim 1, characterized in that, The step of pre-accessing the target webpage based on the Uniform Resource Locator (URL) and generating the main static resource corresponding to the target webpage includes: In response to the operation of inputting the Uniform Resource Locator into the target browser, the target webpage is loaded; During the loading of the target webpage, the target style resource file and target interaction resource file required for preloading the target webpage are queried from the static resource file; From the target style resource file, obtain style resource information for the target webpage; Based on the interface information in the target interactive resource file, obtain the interactive resource information for the target webpage; The target style resource file, the target interactive resource file, the style resource information, and the interactive resource information are merged to obtain the main static resource.

3. The method according to claim 2, characterized in that, The step of obtaining interactive resource information for the target webpage based on the interface information in the target interactive resource file includes: Based on the interface information in the target interactive resource file, an access request for accessing the content distribution server is generated. The access request is pushed to the content distribution server; Receive the interactive resource information pushed by the content distribution server in response to the access request.

4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: The main offline package is pushed to the content distribution server, so that the content distribution server generates the main download link corresponding to the main offline package; First configuration information is generated based on the main download link pushed by the content distribution server, and the first configuration information is pushed to the configuration server. The first configuration information is used to download the main offline package.

5. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Compress the static resources in the static resource file, excluding the main static resource, to generate a sub-offline package corresponding to the target webpage; The sub-offline package is pushed to the content distribution server, so that the content distribution server generates a sub-download link corresponding to the sub-offline package; Second configuration information is generated based on the sub-download link pushed by the content distribution server, and the second configuration information is pushed to the configuration server. The second configuration information is used to download the sub-offline package.

6. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Get the current anchor version number, the new offline package, and the latest version number of the new offline package; Based on the fusion result of the preset version number interval and the current anchor version number, it is determined whether the latest version number of the new offline package is the latest anchor version number; If the latest version number is the latest anchor version number, then determine the first difference packet between the new offline package and the historical anchor offline packages corresponding to each historical anchor version number, and the second difference packet between the new offline package and the current anchor offline package corresponding to the current anchor version number; If the latest version number is not the latest anchor version number, then a third differential package is determined between the new offline package and the current anchor offline package; The historical anchor offline package, the current anchor offline package, and the new offline package are of the same package type.

7. The method according to claim 6, characterized in that, The method further includes: The first differential package and the second differential package are pushed to the content distribution server so that the content distribution server generates a first download link corresponding to the first differential package and a second download link corresponding to the second differential package. A first mapping relationship is constructed based on the first differential version number of the first differential package and the first download link pushed by the content distribution server. The first mapping relationship is pushed to the configuration server so that the configuration server generates a first configuration file based on the first mapping relationship and sends the first configuration file to the client. A second mapping relationship is constructed based on the second differential version number of the second differential package and the second download link pushed by the content distribution server. The second mapping relationship is then pushed to the configuration server so that the configuration server generates a second configuration file based on the second mapping relationship and distributes the second configuration file to the client.

8. The method according to claim 6, characterized in that, The method further includes: The third differential package is pushed to the content distribution server so that the content distribution server generates a third download link corresponding to the third differential package; A third mapping relationship is constructed based on the third differential version number of the third differential package and the third download link pushed by the content distribution server; The third mapping relationship is pushed to the configuration server, so that the configuration server generates a third configuration file based on the third mapping relationship and sends the third configuration file to the client.

9. A method for rendering a webpage, characterized in that, The method includes: In response to the client's startup operation, the main offline package corresponding to the target webpage is obtained. The main offline package is obtained by compressing the main static resources. The main static resources are generated by pre-accessing the target webpage based on the Uniform Resource Locator corresponding to the static resource file. The static resource file is built by the build server based on the source code file corresponding to the target webpage. The target webpage is rendered based on the main static resources corresponding to the main offline package.

10. The method according to claim 9, characterized in that, The step of obtaining the main offline package corresponding to the target webpage includes: In response to a request for configuration information for the target webpage, the first configuration information corresponding to the target webpage is obtained from the configuration server; Based on the main download link carried by the first configuration information, access the content distribution server and download the main offline package corresponding to the main download link from the content distribution server.

11. The method according to claim 9, characterized in that, The method further includes: In response to a trigger operation on the target webpage, second configuration information corresponding to the target webpage is obtained from the configuration server; Based on the sub-download link carried by the second configuration information, access the content distribution server and download the sub-offline package from the content distribution server; The target webpage is rendered based on other static resources corresponding to the sub-offline package.

12. The method according to any one of claims 9 to 11, characterized in that, The method further includes: Receive the latest version number of the new offline package pushed by the configuration server and the second configuration file; Determine whether the version number of the local offline package is the current anchor version number, and whether the latest version number is the latest anchor version number; If the version number of the local offline package is the current anchor version number and the latest version number is the latest anchor version number, then query the second download link corresponding to the second differential package from the second configuration file; Download the second differential package from the content distribution server based on the second download link; Based on the fusion result of the local offline package and the second differential package, the local offline package is updated to the new offline package; The second configuration file is used to store the second download link corresponding to the second differential package. The second differential package is the differential package between the new offline package and the current anchor offline package corresponding to the current anchor version number. The local offline package, the current anchor offline package and the new offline package have the same package type.

13. The method according to claim 12, characterized in that, The method further includes: Receive the third configuration file pushed by the configuration server; If the version number of the local offline package is the current anchor version number and the latest version number is not the latest anchor version number, then query the third download link corresponding to the third differential package from the third configuration file; The third differential package is downloaded from the content distribution server based on the third download link; Based on the fusion result of the local offline package and the third differential package, the local offline package is updated to the new offline package; The third configuration file is used to store the third download link corresponding to the third differential package. The third differential package is the differential package between the new offline package and the current anchor offline package corresponding to the current anchor version number. The local offline package, the current anchor offline package and the new offline package have the same package type.

14. The method according to claim 12, characterized in that, The method further includes: Receive the first configuration file pushed by the configuration server; If the version number of the local offline package is a historical anchor version number and the latest version number is the latest anchor version number, then query the first download link corresponding to the first differential package from the first configuration file; Download the first differential package from the content distribution server based on the first download link; Based on the fusion result of the local offline package and the first differential package, the local offline package is updated to the new offline package; The first configuration file is used to store the first download link corresponding to the first differential package. The first differential package is the differential package between the new offline package and the historical anchor offline package corresponding to the historical anchor version number. The local offline package, the historical anchor offline package and the new offline package have the same package type.

15. The method according to claim 13, characterized in that, The method further includes: Receive the fourth configuration file pushed by the configuration server. If the version number of the local offline package is a historical anchor version number and the latest version number is not the latest anchor version number, then query the fourth download link corresponding to the fourth differential package from the fourth configuration file; Download the fourth differential package from the content distribution server based on the fourth download link; Based on the fusion result between the local offline package, the fourth differential package, and the third differential package, the local offline package is updated to the new offline package; The fourth configuration file is used to store the fourth download link of the fourth differential package, which is the differential package between the current anchor offline package and the historical anchor offline package corresponding to the historical anchor version number.

16. The method according to claim 13, characterized in that, The method further includes: If the version number of the local offline package is not the anchor version number and the latest version number is not the latest anchor version number, then obtain the fifth download link corresponding to the current anchor offline package from the configuration server; Based on the fifth download link, download the current anchor offline package from the content distribution server; Based on the fusion result of the current anchor offline package and the third differential package, the local offline package is updated to the new offline package, wherein the current anchor offline package and the new offline package have the same package type.

17. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the offline package generation method of any one of claims 1 to 8, or the webpage rendering method of any one of claims 9 to 16.

18. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the method for generating an offline package according to any one of claims 1 to 8, or the method for rendering a webpage according to any one of claims 9 to 16.