CN115470432A - Page rendering method and device, electronic equipment and computer readable medium - Google Patents

Page rendering method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN115470432A
CN115470432A CN202211054796.XA CN202211054796A CN115470432A CN 115470432 A CN115470432 A CN 115470432A CN 202211054796 A CN202211054796 A CN 202211054796A CN 115470432 A CN115470432 A CN 115470432A
Authority
CN
China
Prior art keywords
page
network environment
data
identifier
offline
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211054796.XA
Other languages
Chinese (zh)
Inventor
谢冲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202211054796.XA priority Critical patent/CN115470432A/en
Publication of CN115470432A publication Critical patent/CN115470432A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a page rendering method, a page rendering device, electronic equipment and a computer readable medium, and relates to the technical field of computers, wherein the method comprises the following steps: receiving a page rendering request, acquiring a corresponding network identifier and a page identifier, and determining a corresponding network environment based on the network identifier; acquiring page operation data of a page corresponding to the page identifier by a user; in response to the fact that the network environment is switched from the first network environment to the second network environment, determining that offline page resource data corresponding to the page identification are locally stored, and calling the offline page resource data from the local; rendering the page based on the offline page resource data and the page operation data. The condition that the page cannot be accessed by the user in the short-time weak network environment can be guaranteed, the conditions that the webpage access does not respond and is wrong in the weak network environment are improved, the waiting time for opening the webpage is effectively reduced, and the page access experience of the user is improved.

Description

Page rendering method and device, electronic equipment and computer readable medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a page rendering method and apparatus, an electronic device, and a computer-readable medium.
Background
In the current era of mobile internet prevalence, the form of the network includes various network connection modes such as 2G/3G/4G/wifi and the like besides wired connection. The network can be divided into a normal network and a weak network according to the signal strength of the network connection, wherein the weak network is a network with poor signal strength and slow network speed. When a user accesses a page in a weak network environment, no reaction, errors or overlong waiting time for opening the page are often caused.
In the process of implementing the present application, the inventors found that at least the following problems exist in the prior art:
pages cannot be accessed in a weak network environment.
Disclosure of Invention
In view of this, embodiments of the present application provide a page rendering method, a page rendering device, an electronic device, and a computer-readable medium, which can solve the problem that an existing page cannot be accessed in a weak network environment.
To achieve the above object, according to an aspect of an embodiment of the present application, there is provided a page rendering method including:
receiving a page rendering request, acquiring a corresponding network identifier and a page identifier, and determining a corresponding network environment based on the network identifier;
acquiring page operation data of a page corresponding to the page identifier by a user;
in response to the fact that the network environment is switched from the first network environment to the second network environment, determining that offline page resource data corresponding to the page identifier are stored locally, and calling the offline page resource data from the local;
rendering the page based on the offline page resource data and the page operation data.
Optionally, after detecting that the network environment is switched from the first network environment to the second network environment, the method further includes:
calling preset offline page resource data in response to the fact that the offline page resource data corresponding to the page identifier are not locally stored;
and rendering the page corresponding to the page identifier based on the preset offline page resource data and the page operation data.
Optionally, after obtaining the page operation data of the page corresponding to the page identifier identified by the user, the page rendering method further includes:
responding to a first network environment corresponding to the network environment, and acquiring a data identifier corresponding to the page rendering request;
acquiring corresponding online page resource data according to the page identifier and the data identifier;
and rendering the page corresponding to the page identifier based on the online page resource data and the page operation data.
Optionally, after obtaining the corresponding online page resource data, the method further includes:
and storing the online page resource data and the page operation data to the local.
Optionally, after obtaining the corresponding online page resource data, the method further includes:
and when the network environment is switched to the first network environment, updating the locally stored page resource data corresponding to the page identifier by using the online page resource data.
Optionally, the first network environment is a normal network environment, and the second network environment is a weak network environment.
Optionally, the obtaining of the page operation data of the page corresponding to the page identifier by the user includes:
capturing the operation of a user on a page corresponding to the page identifier;
generating an operation queue based on each operation;
and determining the operation queue as page operation data of a page corresponding to the page identification by the user.
Optionally, after detecting that the network environment is switched from the first network environment to the second network environment, the method further includes:
generating an offline task queue according to the operation queue, and calling a task scheduler to submit the offline task queue to the network task when the network environment is detected to be switched from a second network environment to a first network environment;
and executing the network task.
In addition, the present application also provides a page rendering apparatus, including:
the receiving unit is configured to receive the page rendering request, acquire the corresponding network identifier and the page identifier, and determine the corresponding network environment based on the network identifier;
a data acquisition unit configured to acquire page operation data of a page corresponding to the page identification by a user;
the data calling unit is configured to respond to the detection that the network environment is switched from a first network environment to a second network environment, determine that offline page resource data corresponding to the page identifier are locally stored, and call the offline page resource data from the local;
a page rendering unit configured to render a page based on the offline page resource data and the page operation data.
Optionally, the page rendering unit is further configured to:
calling preset offline page resource data in response to the fact that the offline page resource data corresponding to the page identifier are not locally stored;
and rendering the page corresponding to the page identifier based on the preset offline page resource data and the page operation data.
Optionally, the page rendering unit is further configured to:
responding to a first network environment corresponding to the network environment, and acquiring a data identifier corresponding to the page rendering request;
acquiring corresponding online page resource data according to the page identifier and the data identifier;
and rendering the page corresponding to the page identifier based on the online page resource data and the page operation data.
Optionally, the page rendering apparatus further includes a storage unit configured to:
and storing the online page resource data and the page operation data to the local.
Optionally, the page rendering apparatus further includes an updating unit configured to:
and when the network environment is switched to the first network environment, updating the locally stored page resource data corresponding to the page identifier by using the online page resource data.
Optionally, the first network environment is a normal network environment, and the second network environment is a weak network environment.
Optionally, the data acquisition unit is further configured to:
capturing the operation of a user on a page corresponding to the page identifier;
generating an operation queue based on each operation;
and determining the operation queue as page operation data of a page corresponding to the page identification by the user.
Optionally, the page rendering device further comprises a task execution unit configured to:
generating an offline task queue according to the operation queue, and when the network environment is detected to be switched from a second network environment to a first network environment, calling a task scheduler to submit the offline task queue to the network task;
and executing the network task.
In addition, the present application also provides a page rendering electronic device, including: one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement the page rendering method as described above.
In addition, the application also provides a computer readable medium, on which a computer program is stored, and when the program is executed by a processor, the page rendering method is realized.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of obtaining a corresponding network identifier and a page identifier by receiving a page rendering request, and determining a corresponding network environment based on the network identifier; acquiring page operation data of a page corresponding to the page identifier by a user; when the network environment is detected to be switched from a first network environment to a second network environment, determining that offline page resource data corresponding to the page identifier is locally stored, and calling the offline page resource data from the local; rendering the page based on the offline page resource data and the page operation data. The method and the device can ensure that the condition that the page cannot be accessed by the user in the short-time weak network environment can be avoided, the conditions that the webpage access does not respond and has errors in the weak network environment can be improved, the waiting time for opening the webpage can be effectively reduced, and the access experience of the user on the page can be improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a further understanding of the application and are not to be construed as limiting the application. Wherein:
FIG. 1 is a schematic diagram of a main flow of a page rendering method provided according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating a main flow of a page rendering method according to an embodiment of the present application;
FIG. 3 is a diagram of a web-aware environment page access provided according to one embodiment of the present application;
FIG. 4 is a schematic diagram of a page static resource update provided according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a page data storage structure provided in accordance with one embodiment of the present application;
FIG. 6 is a schematic diagram of a page operation response provided in accordance with one embodiment of the present application;
FIG. 7 is a schematic diagram of a page load provided in accordance with one embodiment of the present application;
FIG. 8 is a schematic diagram of the main units of a page rendering apparatus according to an embodiment of the present application;
FIG. 9 is an exemplary system architecture diagram to which embodiments of the present application may be applied;
fig. 10 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application to assist in understanding, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness. According to the technical scheme, the data acquisition, storage, use, processing and the like meet the relevant regulations of national laws and regulations.
Fig. 1 is a schematic diagram of a main flow of a page rendering method according to an embodiment of the present application, and as shown in fig. 1, the page rendering method includes:
step S101, receiving a page rendering request, acquiring a corresponding network identifier and a page identifier, and determining a corresponding network environment based on the network identifier.
In this embodiment, an execution subject (for example, a server) of the page rendering method may receive a page rendering request through a wired connection or a wireless connection. The page rendering request may specifically be a request for real-time rendering and displaying based on a user operation on a page. After receiving a page rendering request, the execution subject may obtain a network identifier and a page identifier carried in the request. The network identifier may be a name of a currently connected network, for example, aabbbc, where the name of the network is obtained by customization, and the name of the currently connected network is not specifically limited in this embodiment of the application. The page identifier may be a website of a page currently accessed by the user, for example, www.aabbcc.com/sie = utf-8&f, and the content of the page identifier is not specifically limited in this embodiment of the application. The page identification is used for positioning the corresponding page to acquire the operation data of the user on the corresponding page.
The execution subject may also determine a corresponding network environment based on the obtained network identification. The network environment includes a normal network environment and a weak network environment. The normal network environment is an environment in which the user can smoothly access various web pages; the weak network environment is an environment in which no response occurs when a user accesses a webpage, error information pops up, and the webpage opening time exceeds a preset threshold, that is, a network environment with poor signal intensity and slow network speed.
Step S102, page operation data of the page corresponding to the page identification by the user is obtained.
The page operation data may include data corresponding to operations such as clicking, querying, sliding, and the like of the page corresponding to the page identifier by the user, that is, some operations when the user uses the page, such as operation data of clicking the page, operation data of sliding the page, query operation data, and the like. The execution main body can successively acquire the page operation data of the page corresponding to the page identifier by the user according to the time when the operation occurs. The obtained page operation data may be, for example, an operation queue formed by operations of the user on the page corresponding to the page identifier, which are obtained according to time sequence.
Specifically, acquiring page operation data of a page corresponding to the page identifier by the user includes: capturing the operation of the user on the page corresponding to the page identifier, such as the operation of clicking, querying, sliding and the like on the page by the user in sequence; based on each operation, generating an operation queue (such as clicking, querying and sliding); an operation queue (e.g., click, query, swipe) is determined as page operation data for a page for which the user identifies the corresponding page.
Specifically, after obtaining the page operation data of the page corresponding to the page identifier identified by the user, the method further includes:
responding to a first network environment corresponding to the network environment, and acquiring a data identifier corresponding to the page rendering request; acquiring corresponding online page resource data according to the page identifier and the data identifier; and rendering the page corresponding to the page identifier based on the online page resource data and the page operation data.
In this embodiment of the present application, when the execution subject detects that the current network environment is the first network environment, that is, the normal network environment, the execution subject may obtain a data identifier corresponding to the page rendering request, where the data identifier may be a data name corresponding to the page data, for example, SHA1 (JSPAI 1). The data identification is generated by encrypting the JSAAPI name through SHA 1. For example, the data corresponding to the data identifier may be data such as pictures, prices, text, discounts, and the like in the page. The execution subject can obtain the corresponding online page resource data according to the page identifier and the data identifier. The online page resource data may include page static resource data and online page data. Specifically, the page static resource data may be data with low update frequency of the layout, style, event processing logic, and the like of the page. The online page data refers to pictures, characters and the like seen when the user browses the page, for example, the data with high update frequency such as pictures, names, prices, attributes, detail displays and the like of the commodities in the commodity detail page. The execution subject can obtain the corresponding page static resource data according to the page identifier, and obtain the corresponding online page data according to the data identifier. Then, the execution subject may render the page identification corresponding to the page and display the rendered page based on the online page resource data and the page operation data.
Specifically, after acquiring the corresponding online page resource data, the method further includes: and storing the online page resource data and the page operation data to the local.
Fig. 5 is a schematic diagram of a page data storage structure. Taking the data storage of H5 pages as an example, as shown in fig. 5: h5 page Data is obtained by requesting JSAPI through Http, for some Data which are used for displaying properties and have weak instantaneity, the H5 page code directly stores the Data obtained from the JSAPI interface into a local storage LocalStorage or stores the Data into a light database SQLlite, a page identifier can be generated by encrypting a URL through a Secure Hash Algorithm 1 (SHA 1), and a Data identifier can be generated by encrypting the name of the JSAPI interface through SHA1, for example, a SetDate (SHA 1 (URL), SHA1 (JSAPI 1) and JSAPI1 Data) method is used, so that the storage of the page Data is completed. In the case of a well-networked environment (i.e., in a normal network environment), the page data store needs to be updated each time a user accesses an H5 page. In the case of an H5 page in a weak network environment, the H5 page code GetDate (SHA 1 (URL), SHA1 (JSPAI 1)) can find corresponding page data (i.e. each data below SHA1 (JSPAI 1) in fig. 5) according to the URL and JSAPI name (e.g. SHA1 (URL) and SHA1 (JSPAI 1)), and perform page rendering.
Specifically, after acquiring the corresponding online page resource data, the method further includes:
and when the network environment is switched to the first network environment, updating the locally stored page resource data corresponding to the page identifier by using the online page resource data.
FIG. 4 is a diagram illustrating a page static resource update. In the embodiment of the application, webview: a container for loading and displaying an H5 page in App; SHA1: a secure hash algorithm encrypts different characters to generate a unique encryption symbol; localStorage: a web data storage mode; SQLlite: a lightweight database.
As shown in FIG. 4, static resource storage occurs prior to a static resource update. Taking H5 page static resource storage and update as an example, the static resource storage: the H5 page static resource comprises an HTML file, a JS file, a CSS file and pictures in the page. When a user accesses an H5 page, a user-defined webview function can be called to encrypt a page URL through SHA1 to generate a unique page identification ID, and then static resources of the H5 page are stored in a unique page identification ID directory in a mobile phone. For example, the H5 page static resource is updated every 24 hours, after the static resource is stored for 24 hours, the page static resource is forcibly updated first and then the page is accessed in the case of good network (i.e. in a normal network environment), if the network is not good, the offline page resource data is continuously accessed, and the forced update is executed next time the network is good (i.e. in a normal network environment).
Step S103, in response to detecting that the network environment is switched from the first network environment to the second network environment, determining that offline page resource data corresponding to the page identifier is locally stored, and locally calling the offline page resource data.
Specifically, the first network environment is a normal network environment, and the second network environment is a weak network environment.
When it is detected that the network environment is switched from the first network environment to the second network environment, that is, when the execution main body detects that the network environment is switched from the normal network environment to the weak network environment, the execution main body may detect whether offline page resource data corresponding to the page identifier is stored locally, and if so, locally call the offline page resource data. The locally stored offline page resource data includes the latest page static resource data and page data stored in the last normal network environment, or the page static resource data of the page corresponding to the latest page identifier updated last time (the page static resource data may be data with low update frequency such as layout, style, event processing logic, etc. of the page) and the page data (the page data may be data with high update frequency such as pictures, prices, characters, discounts, etc. in the page).
Specifically, after detecting that the network environment is switched from the first network environment to the second network environment, the method further comprises: generating an offline task queue according to the operation queue, and when the network environment is detected to be switched from a second network environment to a first network environment, calling a task scheduler to submit the offline task queue to the network task; and executing the network task.
Herein, the network task refers to a task actually performed by the server, i.e., a task performed by the server in a normal network environment. When the second network environment is switched to the first network environment, namely when the weak network environment is switched to the normal network environment, the execution main body can call the task scheduler to submit the offline task queue to the network task, the server executes the network task to complete corresponding webpage rendering, and the rendered webpage is displayed to the user.
And step S104, rendering the page based on the offline page resource data and the page operation data.
The execution main body can render the page corresponding to the page identification according to the offline page resource data to obtain a rendered page based on the local storage data, and the execution main body can modify the local data on the rendered page based on the local storage data according to the page operation data to obtain a rendered page corresponding to the user operation result.
In the embodiment, a corresponding network identifier and a page identifier are obtained by receiving a page rendering request, and a corresponding network environment is determined based on the network identifier; acquiring page operation data of a page corresponding to the page identifier by a user; when the network environment is detected to be switched from a first network environment to a second network environment, responding to the fact that offline page resource data corresponding to the page identification are locally stored, and locally calling the offline page resource data; rendering the page based on the offline page resource data and the page operation data. The method and the device can ensure that the condition that the page cannot be accessed by the user in the short-time weak network environment can be avoided, the conditions that the webpage access does not respond and has errors in the weak network environment can be improved, the waiting time for opening the webpage can be effectively reduced, and the access experience of the user on the page can be improved.
Fig. 2 is a schematic main flow diagram of a page rendering method according to an embodiment of the present application, and as shown in fig. 2, the page rendering method includes:
step S201, receiving a page rendering request, obtaining a corresponding network identifier and a page identifier, and determining a corresponding network environment based on the network identifier.
Step S202, page operation data of the page corresponding to the page identification by the user is obtained.
Step S203, when it is detected that the network environment is switched from the first network environment to the second network environment, in response to determining that the offline page resource data corresponding to the page identifier is locally stored, locally invoking the offline page resource data.
And step S204, rendering the page based on the offline page resource data and the page operation data.
Fig. 6 is a schematic diagram of page operation response. For example, as shown in fig. 6, first, the execution main body determines whether the current environment is a weak network environment, if not, the execution main body accesses the online H5 page normally, stores all static resources and page data of the online H5 page simultaneously, and stores the static resources and page data as offline page resource data of the H5 page in a local place; if the operation is a weak network environment, acquiring the operation of the user on the H5 page in the weak network environment, and performing 'false operation' (i.e. the same operation as the operation of the user on the H5 page) on the H5 page based on the operation of the user on the H5 page (i.e. the page corresponding to the acquired page identifier), wherein the 'false operation' is the operation which does not actually generate a call with the server, and the user is considered as a real operation because the 'false operation' can modify local data, so that the user feels the same as the operation of the real data and does not influence the user experience. The method comprises the steps that operation of a user on an H5 page acquired by an execution main body is firstly put into a task scheduler, the task scheduler can judge the current network environment, if the current network environment is a weak network environment, all page operation data of the user are stored in a local queue after 'false operation' is executed, and after the network is recovered, namely the current network environment is switched to a normal network environment, the scheduler simulates real operation of the user to render the page accessed by the user. The OnClick1 () and the OnClick2 () in FIG. 6 refer to the operation events of the page by the user in the weak network environment, such as clicking, sliding, querying, etc., and the operation of the page by the user is responded to by the page in an event manner. According to the method and the device, the user can access the page in an imperceptible manner when the weak network environment is switched with the normal network environment and before and after the switching, and the page access experience of the user is improved.
Step S205, in response to detecting that the network environment is switched from the first network environment to the second network environment, determining that offline page resource data corresponding to the page identifier is not stored locally, and calling preset offline page resource data.
And step S206, rendering the page corresponding to the page identifier based on the preset offline page resource data and the page operation data.
If the first network environment is switched to the second network environment, namely the normal network environment is switched to the weak network environment, the execution main body does not directly load the online H5 resource, but detects whether the offline page resource data of the page corresponding to the page identifier exists locally, if the offline page resource data exists, the offline page resource data are directly loaded to render the page, and simultaneously, the page operation of the page corresponding to the page identifier by the user is stored locally. And if the offline page resource data does not exist, loading the preset offline page as a pocket bottom to ensure the user experience. The offline page resource data refers to page static resource data and page data which are stored locally in advance or are updated newly. Specifically, the page static resource data may be data with low update frequency of layout, style, event processing logic, and the like of the page. The page data refers to pictures, characters, and the like seen by the user when browsing the page, for example, data with high update frequency such as pictures, names, prices, attributes, detail displays, and the like of the commodities in the commodity detail page. The offline page resource data may specifically include HTTML files, CSS files, JS files, picture resources, page data, and the like of the page, and may be placed in the local database of the App in a resource package manner.
The preset offline page refers to a page corresponding to preset offline page resource data, and refers to a locally stored H5 page, the style of the page is consistent with the display data and the online page, and the page is accessed only in a weak network environment.
When the execution main body is determined to be in the weak network environment and offline page resource data corresponding to the page identifier is not stored locally, the execution main body can call preset offline page resource data to access a preset offline page corresponding to the preset offline page resource data, and render the preset offline page to display the rendered page to a user in the weak network environment based on page operation data of the user, so that the situation that the page cannot be accessed by the user in the short-time weak network environment can be avoided, the situations that no response and errors occur in the page access in the weak network environment can be improved, the waiting time for opening the page can be effectively reduced, and the page access experience of the user can be improved.
Fig. 3 is a schematic view of an application scenario of a page rendering method according to an embodiment of the present application. The page rendering method provided by the embodiment of the application can be applied to a page access scene of a user in a weak network environment. As shown in fig. 3, when a user accesses an H5 page, first, it is detected whether a current network state is a weak network environment, if the current network state is not in the weak network environment, that is, the current network state is good, and the current network environment is a normal network environment, the H5 page on the line is normally accessed, all static resources, page data and page operations of the page on the line are stored at the same time, and all static resources, page data and page operations of the stored page on the line are taken as offline resources (in the embodiment of the present application, the offline page resource data) of the H5 page; if the page is in the weak network environment, the online H5 resources are not directly loaded, whether offline resources of the page exist locally is detected, if the offline resources exist, the offline resource rendering pages are directly loaded, page operations are stored locally, and if the offline resources do not exist (in the embodiment of the application, the offline resource data are offline page resource data), preset offline pages are loaded as a bottom pocket to ensure user experience.
FIG. 7 is a schematic view of page loading. As shown in fig. 7, taking H5 page loading as an example: when the H5 page is accessed for the first time, the execution main body stores static resources and online data to the local. When the user accesses the H5 page again in the weak network environment, the execution main body can call the static resource loader to load the static resource locally and can also call the data loader to load the local data, so that the user can also load the H5 page normally in the weak network environment. When a user operates a page, if the network is good, the user directly submits a network task, if the network is in the weak network environment, an offline task is created, and the offline task is submitted to an offline task queue through a task scheduler in the weak network environment, and the offline task can also operate local data, so that the user can also normally operate the page in the weak network environment. When the network is recovered, the execution main body can submit each offline task in the offline task queue to the network task, so that the operation of the user in the weak network environment is changed into a true operation, the user is prevented from suddenly entering the weak network environment and having no response when accessing the page, the user can be ensured to normally access the H5 page in the weak network environment, and the user experience is improved.
According to the embodiment of the application, the cache mechanism of the H5 page is improved, cache data are not limited to the layout and the style of the page any more, the capabilities of storing page data and storing page operation are increased, the situation that a page cannot be accessed can be guaranteed not to occur in a short-time weak network environment, and the access experience of the H5 page is improved. Meanwhile, the page rendering method can be further extended to media APP, such as short video APP, news APP and the like, user experience is improved, and the page rendering method can be normally used in weak network environments such as elevators.
Fig. 8 is a schematic diagram of main units of a page rendering apparatus according to an embodiment of the present application. As shown in fig. 8, the page rendering apparatus 800 includes a receiving unit 801, a data obtaining unit 802, a data calling unit 803, and a page rendering unit 804.
A receiving unit 801 configured to receive a page rendering request, obtain a corresponding network identifier and a page identifier, and determine a corresponding network environment based on the network identifier;
a data acquisition unit 802 configured to acquire page operation data of a page identified by a user to correspond to the page;
a data calling unit 803 configured to, in response to detecting that the network environment is switched from the first network environment to the second network environment, determine that offline page resource data corresponding to the page identifier is locally stored, and call the offline page resource data from the local;
a page rendering unit 804 configured to render the page based on the offline page resource data and the page operation data.
In some embodiments, page rendering unit 804 is further configured to: in response to the fact that offline page resource data corresponding to the page identification are not stored locally, calling preset offline page resource data; and rendering the page corresponding to the page identifier based on preset offline page resource data and page operation data.
In some embodiments, the page rendering unit 804 is further configured to: responding to a first network environment corresponding to the network environment, and acquiring a data identifier corresponding to the page rendering request; acquiring corresponding online page resource data according to the page identifier and the data identifier; and rendering the page corresponding to the page identifier based on the online page resource data and the page operation data.
In some embodiments, the page rendering apparatus further includes a storage unit, not shown in fig. 8, configured to: and storing the online page resource data and the page operation data to the local.
In some embodiments, the page rendering apparatus further comprises an updating unit, not shown in fig. 8, configured to: and when the network environment is switched to a first network environment, updating the locally stored page resource data corresponding to the page identifier by using the online page resource data.
In some embodiments, the first network environment is a normal network environment and the second network environment is a weak network environment.
In some embodiments, the data acquisition unit 802 is further configured to: capturing the operation of a user on a page corresponding to the page identifier; generating an operation queue based on each operation; and determining the operation queue as page operation data of the page corresponding to the page identification by the user.
In some embodiments, the page rendering apparatus further comprises a task execution unit, not shown in fig. 8, configured to: generating an offline task queue according to the operation queue, and when the network environment is detected to be switched from a second network environment to a first network environment, calling a task scheduler to submit the offline task queue to a network task; and executing the network task.
It should be noted that, in the present application, the page rendering method and the page rendering apparatus have a corresponding relationship in the specific implementation content, so the repeated content is not described again.
Fig. 9 shows an exemplary system architecture 900 to which the page rendering method or the page rendering apparatus according to the embodiment of the present application may be applied.
As shown in fig. 9, the system architecture 900 may include end devices 901, 902, 903, a network 904, and a server 905. Network 904 is the medium used to provide communication links between terminal devices 901, 902, 903 and server 905. Network 904 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 901, 902, 903 to interact with a server 905 over a network 904 to receive or send messages and the like. The terminal devices 901, 902, 903 may have installed thereon various messenger client applications such as, for example only, a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, social platform software, etc.
The terminal devices 901, 902, 903 may be various electronic devices having a page rendering processing screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 905 may be a server providing various services, such as a background management server (for example only) providing support for page rendering requests submitted by users using the terminal devices 901, 902, 903. The background management server can receive the page rendering request, acquire the corresponding network identifier and the page identifier, and determine the corresponding network environment based on the network identifier; acquiring page operation data of a page corresponding to the page identifier by a user; when the network environment is detected to be switched from a first network environment to a second network environment, determining that offline page resource data corresponding to the page identifier is locally stored, and calling the offline page resource data from the local; rendering the page based on the offline page resource data and the page operation data. The condition that the page cannot be accessed by the user in the short-time weak network environment can be guaranteed, the conditions that the webpage access does not respond and is wrong in the weak network environment are improved, the waiting time for opening the webpage is effectively reduced, and the page access experience of the user is improved.
It should be noted that the page rendering method provided in the embodiment of the present application is generally executed by the server 905, and accordingly, the page rendering apparatus is generally disposed in the server 905.
It should be understood that the number of terminal devices, networks, and servers in fig. 9 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 10, shown is a block diagram of a computer system 1000 suitable for use in implementing a terminal device of an embodiment of the present application. The terminal device shown in fig. 10 is only an example, and should not bring any limitation to the functions and the use range of the embodiment of the present application.
As shown in fig. 10, the computer system 1000 includes a Central Processing Unit (CPU) 1001 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1002 or a program loaded from a storage section 1008 into a Random Access Memory (RAM) 1003. In the RAM1003, various programs and data necessary for the operation of the computer system 1000 are also stored. The CPU1001, ROM1002, and RAM1003 are connected to each other via a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
The following components are connected to the I/O interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output section 1007 including a display such as a Cathode Ray Tube (CRT), a liquid crystal credit authorization query processor (LCD), and the like, and a speaker; a storage portion 1008 including a hard disk and the like; and a communication section 1009 including a network interface card such as a LAN card, a modem, or the like. The communication section 1009 performs communication processing via a network such as the internet. The driver 1010 is also connected to the I/O interface 1005 as necessary. A removable medium 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1010 as necessary, so that a computer program read out therefrom is mounted into the storage section 1008 as necessary.
In particular, according to embodiments disclosed herein, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments disclosed herein include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication part 1009 and/or installed from the removable medium 1011. The computer program performs the above-described functions defined in the system of the present application when executed by the Central Processing Unit (CPU) 1001.
It should be noted that the computer readable medium shown in the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a receiving unit, a data obtaining unit, a data calling unit, and a page rendering unit. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to receive a page rendering request, obtain a corresponding network identifier and a page identifier, and determine a corresponding network environment based on the network identifier; acquiring page operation data of a page corresponding to the page identifier by a user; when the network environment is detected to be switched from a first network environment to a second network environment, determining that offline page resource data corresponding to the page identifier is locally stored, and calling the offline page resource data from the local; rendering the page based on the offline page resource data and the page operation data.
According to the technical scheme of the embodiment of the application, the condition that the page cannot be accessed by the user in the short-time weak network environment can be avoided, the conditions that the webpage access in the weak network environment is unresponsive and wrong are improved, the waiting time for opening the webpage is effectively reduced, and the access experience of the user on the page is improved.
The above-described embodiments should not be construed as limiting the scope of the present application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (12)

1. A page rendering method, comprising:
receiving a page rendering request, acquiring a corresponding network identifier and a page identifier, and determining a corresponding network environment based on the network identifier;
acquiring page operation data of a page corresponding to the page identifier by a user;
in response to the fact that the network environment is switched from a first network environment to a second network environment, determining that offline page resource data corresponding to the page identifier are stored locally, and calling the offline page resource data from the local;
rendering the page based on the offline page resource data and the page operation data.
2. The method of claim 1, wherein after the detecting the network environment is switched from a first network environment to a second network environment, the method further comprises:
calling preset offline page resource data in response to the fact that the offline page resource data corresponding to the page identification are not locally stored;
and rendering the page corresponding to the page identifier based on the preset offline page resource data and the page operation data.
3. The method according to claim 1, wherein after the obtaining of the page operation data of the page corresponding to the page identifier by the user, the method further comprises:
responding to a first network environment corresponding to the network environment, and acquiring a data identifier corresponding to the page rendering request;
acquiring corresponding online page resource data according to the page identifier and the data identifier;
and rendering the page corresponding to the page identifier based on the online page resource data and the page operation data.
4. The method of claim 3, wherein after the obtaining of the corresponding online page resource data, the method further comprises:
and storing the online page resource data and the page operation data to the local.
5. The method of claim 3, wherein after the obtaining of the corresponding online page resource data, the method further comprises:
and when the network environment is switched to a first network environment, updating locally stored page resource data corresponding to the page identifier by using the online page resource data.
6. The method of claim 1, wherein the first network environment is a normal network environment and the second network environment is a weak network environment.
7. The method according to claim 1, wherein the obtaining of the page operation data of the page corresponding to the page identifier by the user comprises:
capturing the operation of a user on the page corresponding to the page identifier;
generating an operation queue based on each operation;
and determining the operation queue as page operation data of a page corresponding to the page identification by the user.
8. The method of claim 7, wherein after the detecting the network environment is switched from a first network environment to a second network environment, the method further comprises:
generating an offline task queue according to the operation queue, and when the network environment is detected to be switched from a second network environment to a first network environment, calling a task scheduler to submit the offline task queue to a network task;
and executing the network task.
9. A page rendering apparatus, comprising:
the receiving unit is configured to receive a page rendering request, acquire a corresponding network identifier and a page identifier, and determine a corresponding network environment based on the network identifier;
the data acquisition unit is configured to acquire page operation data of a page corresponding to the page identifier;
a data calling unit configured to, in response to detecting that the network environment is switched from a first network environment to a second network environment, determine that offline page resource data corresponding to the page identifier is locally stored, and locally call the offline page resource data;
a page rendering unit configured to render the page based on the offline page resource data and the page operation data.
10. The apparatus of claim 9, wherein the page rendering unit is further configured to:
calling preset offline page resource data in response to the fact that the offline page resource data corresponding to the page identification are not locally stored;
and rendering the page corresponding to the page identifier based on the preset offline page resource data and the page operation data.
11. A page rendering electronic device, comprising:
one or more processors;
a storage device to store one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-8.
CN202211054796.XA 2022-08-31 2022-08-31 Page rendering method and device, electronic equipment and computer readable medium Pending CN115470432A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211054796.XA CN115470432A (en) 2022-08-31 2022-08-31 Page rendering method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211054796.XA CN115470432A (en) 2022-08-31 2022-08-31 Page rendering method and device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN115470432A true CN115470432A (en) 2022-12-13

Family

ID=84368763

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211054796.XA Pending CN115470432A (en) 2022-08-31 2022-08-31 Page rendering method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN115470432A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115966035A (en) * 2022-12-30 2023-04-14 武汉佰钧成技术有限责任公司 Card punching method and related equipment in weak network environment
CN117149468A (en) * 2023-10-30 2023-12-01 建信金融科技有限责任公司 Resource access method and device, electronic equipment and computer readable medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115966035A (en) * 2022-12-30 2023-04-14 武汉佰钧成技术有限责任公司 Card punching method and related equipment in weak network environment
CN117149468A (en) * 2023-10-30 2023-12-01 建信金融科技有限责任公司 Resource access method and device, electronic equipment and computer readable medium

Similar Documents

Publication Publication Date Title
CN107622135B (en) Method and apparatus for displaying information
CN110708346A (en) Information processing system and method
CN115470432A (en) Page rendering method and device, electronic equipment and computer readable medium
CN111597467A (en) Display method and device and electronic equipment
CN110795649A (en) Target page display method, device and system and electronic equipment
CN111596991A (en) Interactive operation execution method and device and electronic equipment
US20210182491A1 (en) Summary generation method and apparatus
CN114528517A (en) View processing method and device, electronic equipment and computer readable medium
CN112183045A (en) Online document processing method and device and electronic equipment
CN111694629A (en) Information display method and device and electronic equipment
CN111273830A (en) Data display method and device, electronic equipment and computer readable medium
CN111783010B (en) Webpage blank page monitoring method, device, terminal and storage medium
CN110619101B (en) Method and apparatus for processing information
CN111177634A (en) Multi-language supporting file content loading method, device, equipment and medium
CN115563134A (en) Interaction method, interaction device, electronic equipment and computer readable medium
CN110874446A (en) Page display method and system, computer system and computer readable medium
CN111274513B (en) Window display method, device, terminal and storage medium
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN113452738A (en) Page loading method and client
CN113778566A (en) Native application calling method and device, electronic equipment and computer readable medium
CN112306317A (en) Unread message notification method and device and electronic equipment
CN110099122B (en) Method and apparatus for sending network request
CN114356788B (en) Application program detection method, device, equipment and medium based on user information
CN112965778B (en) Chat page display method, chat page display device, electronic equipment and computer readable medium
CN114791898A (en) File processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination