Page display method and device, computer device, and readable storage medium
Patent Information
- Application Number
- CN202310150464.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-09
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2043-02-09
AI Technical Summary
[0004]有鉴于此,本发明提供了一种页面展示方法、装置、计算机设备及可读存储介质,主要目的在于解决目前在加载或刷新H5页面时,由于网络问题而导致的页面白屏或者加载慢的问题
[0059]借由上述技术方案,本申请提供了一种页面展示方法,首先当检测到用户请求启动应用程序时,获取应用程序的程序页面对应的最新资源版本号和本地资源版本号,接着若最新资源版本号和本地资源版本号不一致,则向服务器请求获取最新资源版本号指示的最新页面资源包,以及采用最新页面资源包对本地页面资源包进行替换,随后响应于用户的页面访问请求,获取程序页面对应的路由页面地址,最后获取页面地址白名单,以及在确定页面地址白名单包括路由页面地址时,在本地路径信息指示的本地存储位置获取本地页面资源包,采用本地页面资源包加载并展示程序页面,通过将本地存储的页面资源包替换为最新页面资源包作为本地页面资源包,使得用户请求访问页面时,如果检测到用户输入的路由页面地址在页面地址白名单内,可以直接从本地获取本地页面资源包,加载并展示程序页面,摆脱了网络环境对页面展示的影响,解决了目前在加载或刷新H5页面时,由于网络问题而导致的页面白屏或者加载慢的问题。
Smart Images

Figure CN116339855B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer front-end technology, and more specifically, relates to a page display method, apparatus, computer device, and readable storage medium. Background Technology
[0002] With the popularization of the HTML5 (HyperText Markup Language 5) standard, it is widely used in the development of Internet applications. Among them, H5 pages written based on the HTML5 standard are increasingly used in the development of mobile applications due to their advantages such as hot updates and fast development speed. The hybrid development mode of displaying business using native components + H5 pages has become common.
[0003] In practical applications, when opening an H5 page in an application, it is necessary to request the corresponding page resource package from the server based on the HTTPS protocol. The applicant recognizes that every time an H5 page is opened or refreshed, it is necessary to obtain the page resource package from the server. If the network speed is slow or the mobile terminal is offline, it often takes a long time to load the H5 page or the H5 page cannot be loaded, which can easily lead to problems such as a blank screen or slow loading. Summary of the Invention
[0004] In view of this, the present invention provides a page display method, apparatus, computer device and readable storage medium, the main purpose of which is to solve the problem of page blanking or slow loading caused by network problems when loading or refreshing H5 pages.
[0005] According to a first aspect of the present invention, a page display method is provided, comprising:
[0006] When a user request to launch the application is detected, the latest resource version number and local resource version number corresponding to the application's program page are obtained;
[0007] If the latest resource version number and the local resource version number are inconsistent, the application requests the server to obtain the latest page resource package indicated by the latest resource version number, and replaces the local page resource package with the latest page resource package. The application is associated with local path information, and the local page resource package is stored at the location indicated by the path information.
[0008] In response to the user's page access request, obtain the routing page address corresponding to the program page;
[0009] The system obtains a page address whitelist, and when it is determined that the page address whitelist includes the route page address, it obtains the local page resource package at the local storage location indicated by the local path information, loads and displays the program page using the local page resource package, wherein the page address whitelist includes multiple preset route page addresses and the page route address included in the page address whitelist allows the program page to be loaded using the locally cached page resource package.
[0010] Optionally, before obtaining the latest resource version number and local resource version number corresponding to the application's program page when a user request to launch the application is detected, the method further includes:
[0011] Download the page resource package corresponding to the program page of the application from the server, and store the downloaded page resource package locally as the local page resource package;
[0012] Determine the local path information corresponding to the storage location of the local page resource package, and associate the local path information with the application;
[0013] Determine the domain name information corresponding to the server, and store the domain name information corresponding to the server locally;
[0014] Determine the local path information of the storage location of the domain name information, and associate the local path information of the domain name with the application.
[0015] Optionally, when a user request to launch the application is detected, obtaining the latest resource version number and local resource version number corresponding to the application's program page includes:
[0016] When the user requests to launch the application, the local page resource package is read according to the local path information, and the version number marked on the local page resource package is obtained as the local resource version number;
[0017] Extract the domain name corresponding to the server from the location indicated by the local path information of the domain name, and query the Internet Protocol address (IP address) information of the server corresponding to the domain name;
[0018] Extract the page identifier of the program page, generate a server access request carrying the page identifier, and send the server access request according to the server IP address information, so that the server queries the latest resource version number corresponding to the page identifier and provides feedback;
[0019] Receive the latest resource version number returned by the server based on the server access request.
[0020] Optionally, before determining the page address whitelist, the method further includes:
[0021] Obtain the routing configuration file address, store the routing configuration file address locally, determine the local path information of the storage location of the routing configuration file address, and associate the local path information of the configuration file with the application.
[0022] When a user request to start the application is detected, the routing configuration file address is obtained from the location indicated by the local path information of the configuration file, and a server access request is sent to the target server indicated by the routing configuration file address.
[0023] Obtain the configuration file returned by the target server based on the server access request. The configuration file includes the page address whitelist, page grayscale whitelist, user attribute whitelist, and mapping relationship rules.
[0024] Optionally, when the page address whitelist includes the routed page address, obtaining the local page resource package from the local storage location indicated by the local path information includes:
[0025] Determine the mapping rules in the configuration file;
[0026] When the page address whitelist is detected to include the route page address, the local path information corresponding to the route page address is obtained based on the mapping relationship rule;
[0027] The local page resource package is obtained from the local storage location indicated by the local path information.
[0028] Optionally, the method further includes:
[0029] The application obtains user attribute information and user page grayscale information, which are acquired by the application when the user requests to launch the application.
[0030] When it is determined that the page address whitelist includes the route page address, it is checked whether the user attribute whitelist includes the user attribute information;
[0031] If the user attribute whitelist includes the user attribute information, then it is detected whether the page grayscale whitelist includes the user page grayscale information, and when it is determined that the page grayscale whitelist includes the user page grayscale information, the local page resource package is obtained from the local storage location indicated by the local path information.
[0032] Optionally, after determining that the page address whitelist includes the routed page address, and after obtaining the local page resource package from the local storage location indicated by the local path information, loading and displaying the program page using the local page resource package, the method further includes:
[0033] If the page address whitelist does not include the routed page address, then the latest page resource package is obtained from the server corresponding to the routed page address; or,
[0034] If the user attribute information is not included in the user attribute whitelist, then the server corresponding to the routed page address obtains the latest page resource package; or,
[0035] If the page grayscale whitelist does not include the user page grayscale information, then the latest page resource is obtained from the server corresponding to the routed page address.
[0036] According to a second aspect of the present invention, a page display device is provided, comprising:
[0037] The first acquisition module is used to acquire the latest resource version number and local resource version number corresponding to the program page of the application when a user request to launch the application is detected.
[0038] The replacement module is used to request the latest page resource package indicated by the latest resource version number from the server if the latest resource version number and the local resource version number are inconsistent, and to replace the local page resource package with the latest page resource package, wherein the application is associated with local path information, and the local page resource package is stored at the location indicated by the path information.
[0039] The second acquisition module is used to obtain the routing page address corresponding to the program page in response to the user's page access request;
[0040] The display module is used to obtain a page address whitelist, and when it is determined that the page address whitelist includes the route page address, to obtain the local page resource package at the local storage location indicated by the local path information, and to load and display the program page using the local page resource package. The page address whitelist includes multiple preset route page addresses, and the page route address included in the page address whitelist allows the program page to be loaded using the locally cached page resource package.
[0041] Optionally, the device further includes:
[0042] The download module is used to download the page resource package corresponding to the program page of the application from the server, and store the downloaded page resource package locally as the local page resource package;
[0043] The first association module is used to determine the local path information corresponding to the storage location of the local page resource package, and to associate the local path information with the application.
[0044] The storage module is used to determine the domain name information corresponding to the server and store the domain name information corresponding to the server locally;
[0045] The second association module is used to determine the local path information of the storage location of the domain name information and associate the domain name local path information with the application.
[0046] Optionally, the first acquisition module is further configured to, when detecting a user request to launch the application, read the local page resource package according to the local path information, obtain the version number marked on the local page resource package as the local resource version number; extract the domain name corresponding to the server at the location indicated by the domain name local path information, query the server Internet Protocol address (IP address) information corresponding to the domain name; extract the page identifier of the program page, generate a server access request carrying the page identifier, and send the server access request according to the server IP address information, so that the server queries the latest resource version number corresponding to the page identifier and provides feedback; and receive the latest resource version number returned by the server based on the server access request.
[0047] Optionally, the device further includes:
[0048] The third association module is used to obtain the routing configuration file address, store the routing configuration file address locally, determine the local path information of the storage location of the routing configuration file address, and associate the local path information of the configuration file with the application.
[0049] The third acquisition module is used to acquire the routing configuration file address at the location indicated by the local path information of the configuration file when a user request to start the application is detected, and to send a server access request to the target server indicated by the routing configuration file address.
[0050] The fourth acquisition module is used to acquire the configuration file returned by the target server based on the server access request. The configuration file includes the page address whitelist, page grayscale whitelist, user attribute whitelist, and mapping relationship rules.
[0051] Optionally, the display module is further configured to determine the mapping relationship rules in the configuration file; when the page address whitelist is detected to include the route page address, obtain the local path information corresponding to the route page address based on the mapping relationship rules; and obtain the local page resource package at the local storage location indicated by the local path information.
[0052] Optionally, the device further includes:
[0053] The fifth acquisition module is used to acquire user attribute information and user page grayscale information, wherein the user attribute information and the user page grayscale information are acquired by the application when the user requests to launch the application;
[0054] The display module is further configured to, when it is determined that the page address whitelist includes the route page address, detect whether the user attribute whitelist includes the user attribute information; if the user attribute whitelist includes the user attribute information, detect whether the page grayscale whitelist includes the user page grayscale information; and when it is determined that the page grayscale whitelist includes the user page grayscale information, obtain the local page resource package from the local storage location indicated by the local path information.
[0055] Optionally, the device further includes:
[0056] The sixth acquisition module is used to acquire the latest page resource package from the server corresponding to the routed page address if the page address whitelist does not include the routed page address; or, if the user attribute whitelist does not include the user attribute information, acquire the latest page resource package from the server corresponding to the routed page address; or, if the page grayscale whitelist does not include the user page grayscale information, acquire the latest page resource from the server corresponding to the routed page address.
[0057] According to a third aspect of the present invention, a computer device is provided, including a memory and a processor, the memory storing a computer program, characterized in that the processor executes the computer program to implement the steps of the method described in any of the first aspects above.
[0058] According to a fourth aspect of the present invention, a readable storage medium is provided having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of the first aspects above.
[0059] By employing the above technical solution, this application provides a page display method. First, when a user request to launch an application is detected, the latest resource version number and local resource version number corresponding to the application's program page are obtained. Then, if the latest resource version number and the local resource version number are inconsistent, a request is made to the server to obtain the latest page resource package indicated by the latest resource version number, and the local page resource package is replaced with the latest page resource package. Subsequently, in response to the user's page access request, the routing page address corresponding to the program page is obtained. Finally, a page address whitelist is obtained, and when it is determined that the page address whitelist includes the routing page address, the local page resource package is obtained from the local storage location indicated by the local path information. The program page is loaded and displayed using the local page resource package. By replacing the locally stored page resource package with the latest page resource package as the local page resource package, when a user requests to access a page, if the routing page address entered by the user is detected to be within the page address whitelist, the local page resource package can be directly obtained from the local storage, and the program page can be loaded and displayed. This eliminates the influence of the network environment on page display and solves the problem of page blanking or slow loading caused by network issues when loading or refreshing H5 pages.
[0060] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0061] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0062] Figure 1 A flowchart of a page display method provided in an embodiment of this application is shown.
[0063] Figure 2 A flowchart of another page display method provided in an embodiment of this application is shown.
[0064] Figure 3 A flowchart of another page display method provided in an embodiment of this application is shown.
[0065] Figure 4A A schematic diagram of the structure of a page display device provided in an embodiment of this application is shown.
[0066] Figure 4BA schematic diagram of the structure of a page display device provided in an embodiment of this application is shown.
[0067] Figure 4C A schematic diagram of the structure of a page display device provided in an embodiment of this application is shown.
[0068] Figure 4D A schematic diagram of the structure of a page display device provided in an embodiment of this application is shown.
[0069] Figure 4E A schematic diagram of the structure of a page display device provided in an embodiment of this application is shown.
[0070] Figure 5 A schematic diagram of the device structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0071] Various embodiments and features of this application are described herein with reference to the accompanying drawings.
[0072] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.
[0073] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0074] These and other features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.
[0075] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application.
[0076] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.
[0077] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.
[0078] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in other embodiments,” all of which may refer to one or more of the same or different embodiments according to this application.
[0079] This application provides a page display method, such as... Figure 1 As shown, it includes:
[0080] 101. When a user requests to launch the application, obtain the latest resource version number and local resource version number corresponding to the application's program page.
[0081] In this embodiment of the application, when a user launches the application, the application will detect the user's launch trigger operation and simultaneously obtain the latest resource version number and local resource version number corresponding to the application's program page. For example, the version number of the page resource package stored locally is 1.1.0, and the version number of the latest page resource package stored on the server is 1.1.1. When the application detects that the user requests to launch the application, the application will automatically obtain the local resource version number 1.1.0 from the local machine and the latest resource version number 1.1.1 from the server.
[0082] 102. If the latest resource version number and the local resource version number are inconsistent, request the latest page resource package indicated by the latest resource version number from the server, and replace the local page resource package with the latest page resource package.
[0083] The inventors recognized that in practical applications, each time an H5 page is opened or refreshed, a page resource package needs to be retrieved from the server. If the network speed is slow or the mobile terminal is offline, it often takes a long time to load the H5 page or it may fail to load at all, easily resulting in a blank screen or slow loading. Based on this, the inventors adopted a local page resource package to load the H5 page. The H5 page consists of three parts: HTML5 (HyperText Markup Language 5), CSS (Cascading Style Sheets), and JavaScript. HTML5 is responsible for defining the webpage structure, CSS is responsible for controlling the style of elements on the page and beautifying the page, and JavaScript is responsible for defining the behavior of the page and responding to user operations. It can be understood that HTML constructs the framework of the human skeleton, CSS adds flesh and blood to the framework and dresses it up, and JavaScript gives life to the human and makes it move. It should be noted that in practical applications, other pages besides H5 pages can also be opened. The specific type of page opened is not specifically limited here.
[0084] In this embodiment of the application, after obtaining the latest resource version number and local resource version number corresponding to the application's program page, the application checks whether the obtained latest resource version number and local resource version number are consistent. If the latest resource version number and local resource version number are inconsistent, the application requests the server to obtain the latest page resource package indicated by the latest resource version number, and replaces the local page resource package with the latest page resource package. The application is associated with local path information, and the local page resource package is stored at the location indicated by the path information.
[0085] It should be noted that the server in this application embodiment can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, so that the application can normally obtain page resource packages from the server and implement the technical solutions described in this application.
[0086] 103. In response to a user's page access request, obtain the route page address corresponding to the program page.
[0087] In this embodiment of the application, when the application detects that a user has entered a route page address in the address bar of the browser, the application obtains the route page address corresponding to the program page.
[0088] 104. Obtain the page address whitelist, and when it is determined that the page address whitelist includes the route page address, obtain the local page resource package from the local storage location indicated by the local path information, and use the local page resource package to load and display the program page.
[0089] In this embodiment of the application, after obtaining the routing page address corresponding to the program page, a page address whitelist pre-obtained by the application is obtained, and it is detected whether the page address whitelist includes the routing page address input by the user. If the page address whitelist includes the routing page address, a local page resource package is obtained from the local storage location indicated by the local path information, and the program page is loaded and displayed using the local page resource package. The page address whitelist includes multiple preset routing page addresses, and the page routing addresses included in the page address whitelist are allowed to load the program page using the locally cached page resource package.
[0090] Specifically, after obtaining the local page resource package, loading and displaying the program page using the local page resource package includes the following steps: First, parsing the Hypertext Markup Language included in the local page resource package and constructing a Document Object Model (DOM). Next, parsing the Cascading Style Sheets (CSS) included in the local page resource package and determining the calculated style of each node in the DOM. Subsequently, generating a layout model based on the DOM and the calculated style of each node, and generating a drawing order table and layer model based on the layout model. Finally, synthesizing a compositor frame based on the drawing order table and layer model, rendering the compositor frame, and displaying the program page.
[0091] The method provided in this application embodiment, when detecting a user request to launch an application, obtains the latest resource version number and local resource version number corresponding to the application's program page. If the latest resource version number and local resource version number are inconsistent, it requests the latest page resource package indicated by the latest resource version number from the server and replaces the local page resource package with the latest page resource package. Subsequently, in response to the user's page access request, it obtains the routing page address corresponding to the program page. Finally, it obtains a page address whitelist. If the page address whitelist includes the routing page address, it obtains the local page resource package from the local storage location indicated by the local path information. The program page is then loaded and displayed using the local page resource package. By replacing the locally stored page resource package with the latest page resource package as the local page resource package, when a user requests to access a page, if the user-inputted routing page address is detected to be within the page address whitelist, the local page resource package can be directly obtained from the local storage, and the program page can be loaded and displayed. This eliminates the influence of the network environment on page display and solves the problem of page blanking or slow loading caused by network issues when loading or refreshing H5 pages.
[0092] This application also provides a page display method, such as... Figure 2 As shown, it includes:
[0093] 201. Determine the local path information and associate it with the application, and determine the domain name local path information and associate it with the application.
[0094] In this embodiment of the application, before obtaining the latest resource version number and local resource version number corresponding to the application's program page, it is necessary to first download the page resource package corresponding to the application's program page from the server, store the downloaded page resource package as a local page resource package locally, determine the local path information corresponding to the storage location of the local page resource package, and associate the local path information with the application. At the same time, it is also necessary to determine the domain name information corresponding to the server in advance, store the domain name information corresponding to the server locally, determine the local path information of the storage location of the domain name information, and associate the domain name local path information with the application.
[0095] 202. When a user request to launch the application is detected, obtain the latest resource version number and local resource version number corresponding to the application's program page.
[0096] In this embodiment, when a user request to launch the application is detected, the application reads the local page resource package according to the local path information, obtains the version number marked on the local page resource package as the local resource version number, then extracts the domain name corresponding to the server at the location indicated by the domain name local path information, queries the server's Internet Protocol address (IP address) information corresponding to the domain name, then extracts the page identifier of the program page, generates a server access request carrying the page identifier, and sends a server access request according to the server IP address information, so that the server queries the latest resource version number corresponding to the page identifier and provides feedback, and finally receives the latest resource version number returned by the server based on the server access request.
[0097] 203. If the latest resource version number and the local resource version number are inconsistent, request the latest page resource package indicated by the latest resource version number from the server, and replace the local page resource package with the latest page resource package.
[0098] In this embodiment of the application, after obtaining the latest resource version number and local resource version number corresponding to the application's program page, the application checks whether the obtained latest resource version number and local resource version number are consistent. If the latest resource version number and local resource version number are inconsistent, the application requests the server to obtain the latest page resource package indicated by the latest resource version number, and replaces the local page resource package with the latest page resource package. The application is associated with local path information, and the local page resource package is stored at the location indicated by the path information.
[0099] 204. When a user request to start the application is detected, retrieve the configuration file.
[0100] In this embodiment, before determining the page address whitelist, the routing configuration file address is first obtained and stored locally, and the local path information of the storage location of the routing configuration file address is determined. The local path information of the configuration file is associated with the application. Then, when a user request to start the application is detected, the routing configuration file address is obtained at the location indicated by the local path information of the configuration file, and a server access request is sent to the target server indicated by the routing configuration file address. Finally, the configuration file returned by the target server based on the server access request is obtained. The configuration file includes a page address whitelist, a page grayscale whitelist, a user attribute whitelist, and mapping relationship rules.
[0101] 205. In response to a user's page access request, obtain the route page address corresponding to the program page.
[0102] In this embodiment of the application, the routing page address can be a URL (Uniform Resource Locator), which has the format: protocol name: / / resource name, used to represent the location of the resource obtained from the Internet and the method of accessing these resources. For example, http: / / www.njnu.edu.cn / java / index.htlm, where the HTTP protocol name, www.njnu.edu.cn is the hostname, and java / index.htlm is the file path name.
[0103] 206. Obtain the page address whitelist, and when it is determined that the page address whitelist includes the route page address, obtain the local page resource package from the local storage location indicated by the local path information, and use the local page resource package to load and display the program page.
[0104] In this embodiment of the application, after obtaining the page address whitelist, the mapping relationship rules in the configuration file are first determined. When the page address whitelist is detected to include the route page address, the local path information corresponding to the route page address is obtained based on the mapping relationship rules, and then the local page resource package is obtained from the local storage location indicated by the local path information.
[0105] The method provided in this application first determines local path information and associates it with an application, and then determines domain name local path information and associates it with an application. Next, when a user request to launch the application is detected, the latest resource version number and the local resource version number corresponding to the application's program page are obtained. If the latest resource version number and the local resource version number are inconsistent, a request is made to the server to obtain the latest page resource package indicated by the latest resource version number, and the local page resource package is replaced with the latest page resource package. Subsequently, when a user request to launch the application is detected, a configuration file is obtained, and in response to the user's page access request, the corresponding program page is obtained. The system routes page addresses, retrieves a whitelist of page addresses, and, if the whitelist includes the routed page address, retrieves a local page resource package from the local storage location indicated by the local path information. This local resource package is then used to load and display the application page. By replacing the locally stored page resource package with the latest one, when a user requests access to a page, if the user-inputted routed page address is detected to be within the whitelist, the system can directly retrieve the local page resource package, load, and display the application page. This eliminates the influence of network conditions on page display and solves the problem of blank screens or slow loading caused by network issues when loading or refreshing H5 pages.
[0106] This application also provides a page display method, such as... Figure 3 As shown, it includes:
[0107] 301. Determine the local path information and associate it with the application, and determine the domain name local path information and associate it with the application.
[0108] In this embodiment of the application, before obtaining the latest resource version number and local resource version number corresponding to the application's program page, it is necessary to first download the page resource package corresponding to the application's program page from the server, store the downloaded page resource package as the local page resource package locally, determine the local path information corresponding to the storage location of the local page resource package, and associate the local path information with the application. It is also necessary to determine the domain name information corresponding to the server in advance, store the domain name information corresponding to the server locally, determine the local path information of the storage location of the domain name information, and associate the domain name local path information with the application.
[0109] 302. When a user request to launch the application is detected, obtain the latest resource version number and local resource version number corresponding to the application's program page.
[0110] The application in this embodiment can be a browser. Specifically, a browser is an application running on an operating system, with a multi-process structure. Each application must start at least one process to perform its functions, which specifically includes a user interface, a browser engine, and a rendering engine. When an address is entered in the browser, the UI thread of the browser process captures the input content. For example, if a URL is accessed, the UI thread starts a network thread to request a distributed database for domain name resolution and begins connecting to the database to obtain data. After the network thread obtains the data, Safe Browsing checks whether the site is malicious. If so, a warning page will be displayed to inform the site of security issues, and the browser will block access. If the site security check passes, the UI thread creates a renderer process to render the page.
[0111] 303. If the latest resource version number and the local resource version number are inconsistent, request the latest page resource package indicated by the latest resource version number from the server, and replace the local page resource package with the latest page resource package.
[0112] In this embodiment of the application, after obtaining the latest resource version number and local resource version number corresponding to the application's program page, the application checks whether the obtained latest resource version number and local resource version number are consistent. If the latest resource version number and local resource version number are inconsistent, the application requests the server to obtain the latest page resource package indicated by the latest resource version number, and replaces the local page resource package with the latest page resource package. The application is associated with local path information, and the local page resource package is stored at the location indicated by the path information.
[0113] 304. When a user request to start the application is detected, retrieve the configuration file.
[0114] In this embodiment, before determining the page address whitelist, the routing configuration file address is obtained, stored locally, and the local path information of the storage location of the routing configuration file address is determined. The local path information of the configuration file is associated with the application. Then, when a user request to start the application is detected, the routing configuration file address is obtained at the location indicated by the local path information of the configuration file, and a server access request is sent to the target server indicated by the routing configuration file address. Subsequently, the configuration file returned by the target server based on the server access request is obtained. The configuration file includes a page address whitelist, a page grayscale whitelist, a user attribute whitelist, and mapping relationship rules.
[0115] 305. In response to a user's page access request, obtain the route page address corresponding to the program page.
[0116] 306. Obtain user attribute information and user page grayscale information. When it is detected that the configuration file includes the route page address, user attribute information and user page grayscale information, obtain the local page resource package.
[0117] In this embodiment, user attribute information and user page grayscale information can be obtained first. The user attribute information and user page grayscale information are obtained by the application when the user requests to start the application. Then, when it is determined that the page address whitelist includes the routed page address, it is checked whether the user attribute whitelist includes the user attribute information. If the user attribute whitelist includes the user attribute information, it is checked whether the page grayscale whitelist includes the user page grayscale information. And when it is determined that the page grayscale whitelist includes the user page grayscale information, the local page resource package is obtained from the local storage location indicated by the local path information.
[0118] 307. When it is detected that the configuration file does not include the route page address, user attribute information, or user page grayscale information, obtain the latest page resource package from the server.
[0119] After obtaining the configuration file, the application checks whether the page address whitelist includes the routed page address. If the whitelist does not include the routed page address, the application retrieves the latest page resource package from the server corresponding to the routed page address. After detecting that the whitelist includes the routed page address, the application continues to check whether the user attribute whitelist includes user attribute information. If the whitelist does not include user attribute information, the application retrieves the latest page resource package from the server corresponding to the routed page address. After detecting that the whitelist includes the user attribute information, the application continues to check whether the page grayscale whitelist includes user page grayscale information. If the grayscale whitelist does not include user page grayscale information, the application retrieves the latest page resource from the server corresponding to the routed page address.
[0120] The method provided in this application first determines local path information and associates it with an application, and then determines domain name local path information and associates it with an application. Next, when a user request to launch the application is detected, the latest resource version number and local resource version number corresponding to the application's program page are obtained. If the latest resource version number and local resource version number are inconsistent, a request is made to the server to obtain the latest page resource package indicated by the latest resource version number, and the local page resource package is replaced with the latest page resource package. Subsequently, when a user request to launch the application is detected, a configuration file is obtained, and in response to the user's page access request, the route page address corresponding to the program page is obtained, and then user attribute information and... The system retrieves local page resource packages when the configuration file includes route page addresses, user attribute information, and user page grayscale information. Conversely, if the configuration file does not include route page addresses, user attribute information, or user page grayscale information, the system retrieves the latest page resource package from the server. By replacing the locally stored page resource package with the latest one, the system ensures that when a user requests access to a page, if the user-input route page address is within the page address whitelist, the system can directly retrieve the local page resource package, load, and display the page. This eliminates the influence of network conditions on page display and resolves the current issue of blank screens or slow loading caused by network problems when loading or refreshing H5 pages.
[0121] Furthermore, as Figure 1 To specifically implement the method, this embodiment of the invention provides a page display device, such as... Figure 4A As shown, it includes: a first acquisition module 401, a replacement module 402, a second acquisition module 403, and a display module 404.
[0122] The first acquisition module 401 is used to acquire the latest resource version number and local resource version number corresponding to the application's program page when a user request to launch the application is detected.
[0123] The replacement module 402 is used to request the latest page resource package indicated by the latest resource version number from the server if the latest resource version number and the local resource version number are inconsistent, and to replace the local page resource package with the latest page resource package. The application is associated with local path information, and the local page resource package is stored at the location indicated by the path information.
[0124] The second acquisition module 403 is used to obtain the route page address corresponding to the program page in response to the user's page access request;
[0125] The display module 404 is used to determine the page address whitelist, and when the page address whitelist includes the route page address, to obtain the local page resource package from the local storage location indicated by the local path information, and to load and display the program page using the local page resource package.
[0126] In specific application scenarios, such as Figure 4B As shown, the device also includes: a download module 405, a first association module 406, a storage module 407, and a second association module 408.
[0127] The download module 405 is used to download the page resource package corresponding to the program page of the application from the server, and store the downloaded page resource package as a local page resource package locally;
[0128] The first association module 406 is used to determine the local path information corresponding to the storage location of the local page resource package, and to associate the local path information with the application.
[0129] The storage module 407 is used to determine the domain name information corresponding to the server and store the domain name information corresponding to the server locally.
[0130] The second association module 408 is used to determine the local path information of the storage location of the domain name information and associate the local path information of the domain name with the application.
[0131] In specific application scenarios, the first acquisition module 401 is further configured to, when a user request to launch the application is detected, read the local page resource package according to the local path information, obtain the version number marked on the local page resource package as the local resource version number; extract the domain name corresponding to the server at the location indicated by the domain name local path information, query the server Internet Protocol address (IP address) information corresponding to the domain name; extract the page identifier of the program page, generate a server access request carrying the page identifier, and send the server access request according to the server IP address information, so that the server queries the latest resource version number corresponding to the page identifier and provides feedback; and receive the latest resource version number returned by the server based on the server access request.
[0132] In specific application scenarios, such as Figure 4C As shown, the device also includes: a third association module 409, a third acquisition module 410, and a fourth acquisition module 411.
[0133] The third association module 409 is used to obtain the routing configuration file address, store the routing configuration file address locally, determine the local path information of the storage location of the routing configuration file address, and associate the local path information of the configuration file with the application.
[0134] The third acquisition module 410 is used to acquire the routing configuration file address at the location indicated by the local path information of the configuration file when a user request to start the application is detected, and send a server access request to the target server indicated by the routing configuration file address.
[0135] The fourth acquisition module 411 is used to acquire the configuration file returned by the target server based on the server access request. The configuration file includes a page address whitelist, a page grayscale whitelist, a user attribute whitelist, and mapping relationship rules.
[0136] In specific application scenarios, the display module 404 is also used to determine the mapping relationship rules in the configuration file; when the page address whitelist is detected to include the route page address, the local path information corresponding to the route page address is obtained based on the mapping relationship rules; and the local page resource package is obtained from the local storage location indicated by the local path information.
[0137] In specific application scenarios, such as Figure 4D As shown, the device also includes a fifth acquisition module 412.
[0138] The fifth acquisition module 412 is used to acquire user attribute information and user page grayscale information, wherein the user attribute information and the user page grayscale information are acquired by the application when the user requests to launch the application;
[0139] The display module 404 is also used to detect whether the user attribute whitelist includes user attribute information when it is determined that the page address whitelist includes the route page address; if the user attribute whitelist includes user attribute information, it detects whether the page grayscale whitelist includes user page grayscale information; and when it is determined that the page grayscale whitelist includes user page grayscale information, it retrieves the local page resource package from the local storage location indicated by the local path information.
[0140] In specific application scenarios, such as Figure 4E As shown, the device also includes a sixth acquisition module 413.
[0141] The sixth acquisition module 413 is used to obtain the latest page resource package from the server corresponding to the routed page address if the page address whitelist does not include the routed page address; or, if the user attribute whitelist does not include the user attribute information, obtain the latest page resource package from the server corresponding to the routed page address; or, if the page grayscale whitelist does not include user page grayscale information, obtain the latest page resource from the server corresponding to the routed page address.
[0142] The apparatus provided in this application firstly obtains the latest resource version number and local resource version number corresponding to the application's program page when a user requests to launch the application via a first acquisition module. Then, if the latest resource version number and the local resource version number are inconsistent, a replacement module requests the latest page resource package indicated by the latest resource version number from the server and replaces the local page resource package with the latest page resource package. Subsequently, a second acquisition module responds to the user's page access request by obtaining the routing page address corresponding to the program page. Finally, a display module determines a page address whitelist, and if the page address whitelist includes the routing page address, it obtains the local page resource package from the local storage location indicated by the local path information, loads and displays the program page using the local page resource package. By replacing the locally stored page resource package with the latest page resource package as the local page resource package, when a user requests to access a page, if the user-input routing page address is detected to be within the page address whitelist, the local page resource package can be directly obtained from the local storage, and the program page can be loaded and displayed. This eliminates the influence of the network environment on page display and solves the problem of page blanking or slow loading caused by network issues when loading or refreshing H5 pages.
[0143] It should be noted that other corresponding descriptions of the functional units involved in the page display device provided in this embodiment of the invention can be found in [reference needed]. Figure 1 and Figures 4A to 4E The corresponding description in [the document] will not be repeated here.
[0144] In an exemplary embodiment, see Figure 5 The invention also provides a computer device including a communication bus, a processor, a memory, and a communication interface. It may also include an input / output interface and a display device, wherein the various functional units can communicate with each other via the bus. The memory stores a computer program, and the processor executes the program stored in the memory to perform the page display method described in the above embodiments.
[0145] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the page display method described above.
[0146] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented in hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0147] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application. Those skilled in the art will understand that the modules in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or can be modified to be located in one or more apparatuses different from this embodiment. The modules of the above-described embodiment can be combined into one module, or further divided into multiple sub-modules.
[0148] The above embodiments are merely exemplary embodiments of this application and are not intended to limit this application. The scope of protection of this application is defined by the claims. Those skilled in the art can make various modifications or equivalent substitutions to this application within its substance and scope of protection, and such modifications or equivalent substitutions should also be considered to fall within the scope of protection of this application.
Claims
1. A page display method, characterized in that, include: When a user request to launch the application is detected, the latest resource version number and local resource version number corresponding to the application's program page are obtained; If the latest resource version number and the local resource version number are inconsistent, the application requests the server to obtain the latest page resource package indicated by the latest resource version number, and replaces the local page resource package with the latest page resource package. The application is associated with local path information, and the local page resource package is stored at the location indicated by the path information. When a user request to launch the application is detected, a configuration file is obtained. The configuration file includes a page address whitelist, a user attribute whitelist, a page grayscale whitelist, and mapping relationship rules. The user attribute whitelist includes multiple preset user attribute information, which is used to detect whether the user attribute whitelist includes user attribute information after determining that the page address whitelist includes routed page addresses. The page grayscale whitelist includes multiple preset user page grayscale information, which is used to detect whether the page grayscale whitelist includes user page grayscale information after determining that the user attribute whitelist includes the user attribute information. When it is determined that the page grayscale whitelist includes the user page grayscale information, the local page resource package is obtained from the local storage location indicated by the local path information. In response to the user's page access request, when it is detected that the user enters the route page address in the address bar of the browser, the route page address corresponding to the program page is obtained; The process involves obtaining a page address whitelist, and when the whitelist includes the routed page address, retrieving the local page resource package from the local storage location indicated by the local path information, loading and displaying the program page using the local page resource package. The whitelist includes multiple preset routed page addresses, and page route addresses included in the whitelist are allowed to load the program page using the locally cached page resource package. Loading and displaying the program page using the local page resource package includes: parsing the Hypertext Markup Language (HMR) included in the local page resource package and constructing a Document Object Model (DOM); parsing the Cascading Style Sheets (CSS) included in the local page resource package and determining the computed style of each node in the DOM; generating a layout model based on the DOM and the computed style of each node, and generating a drawing order table and a layer model based on the layout model; synthesizing a compositor frame based on the drawing order table and the layer model; rendering the compositor frame; and displaying the program page.
2. The page display method according to claim 1, characterized in that, Before obtaining the latest resource version number and local resource version number corresponding to the application's program page when a user request to launch the application is detected, the method further includes: Download the page resource package corresponding to the program page of the application from the server, and store the downloaded page resource package locally as the local page resource package; Determine the local path information corresponding to the storage location of the local page resource package, and associate the local path information with the application; Determine the domain name information corresponding to the server, and store the domain name information corresponding to the server locally; Determine the local path information of the storage location of the domain name information, and associate the local path information of the domain name with the application.
3. The page display method according to claim 2, characterized in that, The step of obtaining the latest resource version number and local resource version number corresponding to the application's program page when a user request to launch the application is detected includes: When the user requests to launch the application, the local page resource package is read according to the local path information, and the version number marked on the local page resource package is obtained as the local resource version number; Extract the domain name corresponding to the server from the location indicated by the local path information of the domain name, and query the Internet Protocol address (IP address) information of the server corresponding to the domain name; Extract the page identifier of the program page, generate a server access request carrying the page identifier, and send the server access request according to the server IP address information, so that the server queries the latest resource version number corresponding to the page identifier and provides feedback; Receive the latest resource version number returned by the server based on the server access request.
4. The page display method according to claim 1, characterized in that, Before determining the page address whitelist, the method further includes: Obtain the routing configuration file address, store the routing configuration file address locally, determine the local path information of the storage location of the routing configuration file address, and associate the local path information of the configuration file with the application. When a user request to start the application is detected, the routing configuration file address is obtained from the location indicated by the local path information of the configuration file, and a server access request is sent to the target server indicated by the routing configuration file address. Obtain the configuration file returned by the target server based on the server access request. The configuration file includes the page address whitelist, page grayscale whitelist, user attribute whitelist, and mapping relationship rules.
5. The page display method according to claim 4, characterized in that, When the routed page address is included in the page address whitelist, retrieving the local page resource package from the local storage location indicated by the local path information includes: Determine the mapping rules in the configuration file; When the page address whitelist is detected to include the route page address, the local path information corresponding to the route page address is obtained based on the mapping relationship rule; The local page resource package is obtained from the local storage location indicated by the local path information.
6. The page display method according to claim 4, characterized in that, The method further includes: The application obtains user attribute information and user page grayscale information, which are acquired by the application when the user requests to launch the application. When it is determined that the page address whitelist includes the route page address, it is checked whether the user attribute whitelist includes the user attribute information; If the user attribute whitelist includes the user attribute information, then it is detected whether the page grayscale whitelist includes the user page grayscale information, and when it is determined that the page grayscale whitelist includes the user page grayscale information, the local page resource package is obtained from the local storage location indicated by the local path information.
7. The page display method according to claim 6, characterized in that, When it is determined that the page address whitelist includes the routed page address, after obtaining the local page resource package from the local storage location indicated by the local path information, and loading and displaying the program page using the local page resource package, the method further includes: If the page address whitelist does not include the routed page address, then the latest page resource package is obtained from the server corresponding to the routed page address; or, If the user attribute whitelist does not include the user attribute information, then the latest page resource package is obtained from the server corresponding to the routed page address; or, If the page grayscale whitelist does not include the user page grayscale information, then the latest page resource is obtained from the server corresponding to the routed page address.
8. A page display device, characterized in that, include: The first acquisition module is used to acquire the latest resource version number and local resource version number corresponding to the program page of the application when a user request to launch the application is detected. The replacement module is used to request the latest page resource package indicated by the latest resource version number from the server if the latest resource version number and the local resource version number are inconsistent, and to replace the local page resource package with the latest page resource package, wherein the application is associated with local path information, and the local page resource package is stored at the location indicated by the path information. The fourth acquisition module is used to acquire a configuration file when a user request to launch the application is detected. The configuration file includes a page address whitelist, a user attribute whitelist, a page grayscale whitelist, and mapping relationship rules. The user attribute whitelist includes multiple preset user attribute information. After determining that the page address whitelist includes a routed page address, the module is used to detect whether the user attribute whitelist includes user attribute information. The page grayscale whitelist includes multiple preset user page grayscale information. After determining that the user attribute whitelist includes the user attribute information, the module is used to detect whether the page grayscale whitelist includes user page grayscale information. When it is determined that the page grayscale whitelist includes the user page grayscale information, the module acquires the local page resource package at the local storage location indicated by the local path information. The second acquisition module is used to respond to the user's page access request. When it is detected that the user enters the routing page address in the address input bar of the browser, the module acquires the routing page address corresponding to the program page. A display module is used to obtain a page address whitelist, and when it is determined that the page address whitelist includes the route page address, to obtain the local page resource package at the local storage location indicated by the local path information, and to load and display the program page using the local page resource package. The page address whitelist includes multiple preset route page addresses, and page route addresses included in the page address whitelist are allowed to load the program page using the locally cached page resource package. The process of loading and displaying the program page using the local page resource package includes: parsing the Hypertext Markup Language included in the local page resource package and constructing a Document Object Model (DOM); parsing the Cascading Style Sheets (CSS) included in the local page resource package and determining the computed style of each node in the DOM; generating a layout model based on the DOM and the computed style of each node, and generating a drawing order table and a layer model based on the layout model; synthesizing a compositor frame based on the drawing order table and the layer model, rendering the compositor frame, and displaying the program page.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Webpage resource lazy loading monitoring method, device and equipment and storage medium
CN109684576A
Page resource loading method, system and device, computer equipment and storage medium
CN114237736A