Disclosure of Invention
The main purpose of the application is to provide a loading method, a device, equipment and a storage medium of HTML5 page resources, which aim to solve the technical problems that the prior art adopts a mobile terminal for mixed development to place the HTML5 resources in a local cache and/or a server terminal, and the flow resource waste and slow loading cannot be simultaneously solved.
In order to achieve the above object, the present application proposes a loading method of HTML5 page resources, where the method includes:
acquiring a mobile terminal starting request;
responding to the mobile terminal starting request, acquiring historical access behavior data, and carrying out click behavior prediction on the historical access behavior data by adopting a click behavior prediction model to obtain a click behavior prediction result;
acquiring an HTML5 resource to be initialized sent by a server according to the click behavior prediction result, and updating a local cache according to the HTML5 resource to be initialized;
acquiring a page loading request, wherein the page loading request carries a page identifier to be loaded;
responding to the page loading request, judging whether the HTML5 resource corresponding to the page identifier to be loaded in the local cache is the same as that in the server side, obtaining a judging result, taking the HTML5 resource corresponding to the page identifier to be loaded in the local cache as the HTML5 resource to be loaded when the judging result is the same as that in the server side, otherwise, acquiring the HTML5 resource from the server side as the HTML5 resource to be loaded according to the page identifier to be loaded;
Responding to the page loading request, carrying out preset click level page expansion prediction according to the page identifier to be loaded and the click behavior prediction result to obtain a page identifier prediction result of the next step, and updating the local cache according to the page identifier prediction result of the next step;
and loading and rendering the page according to the HTML5 resource to be loaded to obtain a target HTML5 page.
Further, before the step of predicting the click behavior of the historical access behavior data by using the click behavior prediction model to obtain a click behavior prediction result, the method comprises the following steps:
obtaining a plurality of training samples, the training samples comprising: accessing behavior sequence sample data;
dividing the training samples according to a preset dividing rule to obtain a training set and a verification set;
training the model to be trained by adopting the training set to obtain a model to be verified, wherein the model to be trained comprises: the device comprises a convolution layer, a p-Max pooling layer, an activation layer and a full connection layer;
verifying the model to be verified by adopting the verification set to obtain a verification result;
when the verification result is failure, carrying out parameter updating on the model to be verified according to the verification result to obtain the model to be trained, and repeatedly executing the step of training the model to be trained by adopting the training set to obtain the model to be verified until the verification result is successful;
And determining the model to be verified, of which the verification result is successful, as the click behavior prediction model.
Further, the step of obtaining the HTML5 resource to be initialized sent by the server according to the click behavior prediction result includes:
acquiring page identifiers from the click behavior prediction result by adopting preset duration to obtain a predicted click page identifier set;
acquiring a version number from the local cache according to the page identification set clicked by prediction to obtain a first local version number set;
acquiring a version number from the server according to the page identification set clicked by prediction to obtain a first server version number set;
comparing version numbers of the same page identifier according to the first local version number set and the first server version number set to obtain a plurality of first comparison results;
when the first comparison results are different, the page identifier corresponding to the first comparison results is used as a page identifier to be initialized;
obtaining a page identification set to be initialized according to all the page identifications to be initialized;
and acquiring the HTML5 resource from the server according to the page identification set to be initialized, and obtaining the HTML5 resource to be initialized.
Further, the step of obtaining the page identifier set for predicting clicking from the click behavior prediction result by using a preset duration includes:
acquiring page classification data, preset initialization progression and preset duration;
and acquiring the page identifier from the click behavior prediction result by adopting the page classification data, the preset initialization level and the preset duration to obtain a page identifier set for predicting clicking.
Further, the step of determining whether the HTML5 resource corresponding to the page identifier to be loaded in the local cache is the same as that in the server to obtain a determination result includes:
acquiring a version number from the local cache according to the page identifier to be loaded to obtain a second local version number;
acquiring a version number from the server according to the page identifier to be loaded to obtain a second server version number;
and when the second local version number is the same as the second server version number, determining that the judging result is the same as the server, otherwise, determining that the judging result is different from the server.
Further, the step of performing preset click progression page expansion prediction according to the page identifier to be loaded and the click behavior prediction result to obtain a page identifier prediction result of the next step, and updating the local cache according to the page identifier prediction result of the next step includes:
Searching the page identifier to be loaded in the click behavior prediction result, and taking all page identifiers of preset click progression corresponding to the page identifiers searched in the click behavior prediction result as page identifier prediction results of the next step;
acquiring a version number from the local cache according to each page identifier in the page identifier prediction result of the next step to obtain a third local version number set;
acquiring a version number from the server according to each page identifier in the page identifier prediction result of the next step respectively to obtain a third server version number set;
comparing version numbers of the same page identifier according to the third local version number set and the third server version number set to obtain a plurality of second comparison results;
when the second comparison results are different, the page identifier corresponding to the second comparison results is used as a preset click progression page identifier to be updated;
obtaining a preset click progression page identification set to be updated according to all the preset click progression page identifications to be updated;
acquiring an HTML5 resource from the server according to the preset click progression page identification set to be updated to obtain the preset click progression page HTML5 resource to be updated;
And updating the local cache according to the HTML5 resource of the page with the preset click level to be updated.
Further, after the step of obtaining the mobile terminal opening request, the method further includes:
acquiring a large-batch page update request sent by the server;
responding to the page mass updating request to acquire network type data;
when the network type data is WIFI or 5G, acquiring an HTML5 resource compression packet sent by the server to obtain a large amount of HTML5 resources to be updated;
decompressing the large amount of HTML5 resources to be updated to obtain decompressed HTML5 resources;
and updating the local cache according to the decompressed HTML5 resource.
The application also provides a loading device of the HTML5 page resource, which comprises:
the first request acquisition module is used for acquiring a mobile terminal opening request;
the click behavior prediction module is used for responding to the mobile terminal opening request, acquiring historical access behavior data, and performing click behavior prediction on the historical access behavior data by adopting a click behavior prediction model to obtain a click behavior prediction result;
the local initialization updating module is used for acquiring HTML5 resources to be initialized sent by the server according to the click behavior prediction result, and updating a local cache according to the HTML5 resources to be initialized;
The second request acquisition module is used for acquiring a page loading request, wherein the page loading request carries a page identifier to be loaded;
the page loading module is used for responding to the page loading request, judging whether the HTML5 resource corresponding to the page identifier to be loaded in the local cache is the same as that in the server side, obtaining a judging result, and taking the HTML5 resource corresponding to the page identifier to be loaded in the local cache as the HTML5 resource to be loaded when the judging result is the same as that in the server side, otherwise, acquiring the HTML5 resource from the server side as the HTML5 resource to be loaded according to the page identifier to be loaded;
responding to the page loading request, judging to respond to the page loading request, and carrying out preset click level page expansion prediction according to the page identifier to be loaded and the click behavior prediction result to obtain a page identifier prediction result of the next step, and updating the local cache according to the page identifier prediction result of the next step;
and the target HTML5 page determining module is used for loading and rendering the page according to the HTML5 resource to be loaded to obtain a target HTML5 page.
The present application also proposes a computer device comprising a memory storing a computer program and a processor implementing the steps of any of the methods described above when the processor executes the computer program.
The present application also proposes a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method of any of the above.
According to the loading method, device and equipment for the HTML5 page resources and the storage medium, historical access behavior data are acquired by responding to a mobile terminal starting request, clicking behavior prediction is carried out on the historical access behavior data by adopting a clicking behavior prediction model, clicking behavior prediction results are obtained, the HTML5 resources to be initialized, which are sent by a server terminal, are acquired according to the clicking behavior prediction results, a local cache is updated according to the HTML5 resources to be initialized, whether the HTML5 resources corresponding to page identifiers to be loaded in the local cache are identical to those of the server terminal is judged according to the page loading request, a judging result is obtained, when the judging result is identical to that of the server terminal, the HTML5 resources corresponding to the page identifiers to be loaded in the local cache are used as the HTML5 resources to be loaded, otherwise, the HTML5 resources are acquired from the server terminal according to the page identifiers to be loaded and are loaded and rendered according to the HTML5 resources to be loaded, and therefore the HTML5 resources in the local cache are more suitable for operation habits of users, and timeliness of loading 5 resources is improved under the condition that comprehensive updating is not needed, and user experience is improved; according to the method, a page loading request is responded, a preset click level page expansion prediction is conducted according to a page identifier to be loaded and a click behavior prediction result, a page identifier prediction result of the next step is obtained, a local cache is updated according to the page identifier prediction result of the next step, HTML5 resources of the preset click level page are stored in the local cache in advance according to user operation, and timeliness of loading the HTML5 resources is further improved; therefore, the method and the device solve the technical problems of traffic resource waste and slow loading at the same time, and improve user experience.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In order to solve the technical problems that in the prior art, the HTML5 resources are placed in a local cache and/or a server by adopting a mobile terminal of hybrid development, and the traffic resource waste and slow loading cannot be simultaneously solved, the application provides a loading method of the HTML5 page resources, and the method is applied to the technical field of artificial intelligence. According to the loading method of the HTML5 page resources, click behavior prediction is performed when a mobile terminal is started, the HTML5 resources in a local cache are initialized according to click behavior prediction results, then page loading requests are responded, when the HTML5 resources corresponding to page identifiers to be loaded in the local cache are the same as those in the server terminal, the HTML5 resources in the local cache are directly loaded, otherwise, the HTML5 resources are obtained from the server terminal to be loaded, preset click level page expansion prediction is performed according to the page identifiers to be loaded and the click behavior prediction results, and the local cache is updated according to the preset click level page expansion prediction results, so that the HTML5 resources in the local cache are more in accordance with operation habits of users, timeliness of loading the HTML5 resources is improved, and user experience is improved under the condition that comprehensive updating is not needed; therefore, the method and the device solve the technical problems of traffic resource waste and slow loading at the same time, and improve user experience.
Referring to fig. 1, in an embodiment of the present application, a method for loading HTML5 page resources is provided, where the method includes:
s1: acquiring a mobile terminal starting request;
s2: responding to the mobile terminal starting request, acquiring historical access behavior data, and carrying out click behavior prediction on the historical access behavior data by adopting a click behavior prediction model to obtain a click behavior prediction result;
s3: acquiring an HTML5 resource to be initialized sent by a server according to the click behavior prediction result, and updating a local cache according to the HTML5 resource to be initialized;
s4: acquiring a page loading request, wherein the page loading request carries a page identifier to be loaded;
s5: responding to the page loading request, judging whether the HTML5 resource corresponding to the page identifier to be loaded in the local cache is the same as that in the server side, obtaining a judging result, taking the HTML5 resource corresponding to the page identifier to be loaded in the local cache as the HTML5 resource to be loaded when the judging result is the same as that in the server side, otherwise, acquiring the HTML5 resource from the server side as the HTML5 resource to be loaded according to the page identifier to be loaded;
S6: responding to the page loading request, carrying out preset click level page expansion prediction according to the page identifier to be loaded and the click behavior prediction result to obtain a page identifier prediction result of the next step, and updating the local cache according to the page identifier prediction result of the next step;
s7: and loading and rendering the page according to the HTML5 resource to be loaded to obtain a target HTML5 page.
According to the method, historical access behavior data are obtained by responding to a mobile terminal opening request, clicking behavior prediction is conducted on the historical access behavior data through a clicking behavior prediction model, clicking behavior prediction results are obtained, HTML5 resources to be initialized, which are sent by a server terminal, are obtained according to the clicking behavior prediction results, a local cache is updated according to the HTML5 resources to be initialized, whether the HTML5 resources corresponding to page identifiers to be loaded in the local cache are the same as those of the server terminal or not is judged according to page loading requests, judging results are obtained, when judging results are the same as those of the server terminal, the HTML5 resources corresponding to the page identifiers to be loaded in the local cache are used as the HTML5 resources to be loaded, otherwise, the HTML5 resources are obtained from the server terminal according to the page identifiers to be loaded and are used as the HTML5 resources to be loaded, loading and rendering of pages are conducted according to the HTML5 resources to be loaded, and therefore the HTML5 resources in the local cache are enabled to be more consistent with operation habits of users, timeliness of loading the HTML5 resources is improved, and user experience is improved under the condition that comprehensive updating is not needed; according to the method, a page loading request is responded, a preset click level page expansion prediction is conducted according to a page identifier to be loaded and a click behavior prediction result, a page identifier prediction result of the next step is obtained, a local cache is updated according to the page identifier prediction result of the next step, HTML5 resources of the preset click level page are stored in the local cache in advance according to user operation, and timeliness of loading the HTML5 resources is further improved; therefore, the method and the device solve the technical problems of traffic resource waste and slow loading at the same time, and improve user experience.
For S1, a mobile terminal opening request sent by a user may be obtained, or may be a mobile terminal opening request sent by a third party application system.
The mobile terminal opening request refers to a request for opening the mobile terminal.
The mobile terminal refers to a software program which can run on the mobile electronic device. Mobile electronic devices include, but are not limited to: cell-phone, tablet computer, wearing equipment.
And S2, responding to the mobile terminal opening request to open the mobile terminal, and acquiring historical access behavior data from a local cache of the mobile terminal.
Optionally, the step of predicting the click behavior of the historical access behavior data by using a click behavior prediction model to obtain a click behavior prediction result includes: and generating a historical access behavior sequence according to the historical access behavior data, inputting the historical access behavior sequence into a click behavior prediction model to perform click behavior prediction, and obtaining a click behavior prediction result.
Optionally, the step of predicting the click behavior by using a click behavior prediction model to obtain a click behavior prediction result further includes: judging whether the historical access behavior data is empty or not; when the historical access behavior data is empty, acquiring preset click behavior data, and taking the preset click behavior data as a click behavior prediction result; when the historical access behavior data is not empty, generating a historical access behavior sequence according to the historical access behavior data, inputting the historical access behavior sequence into a click behavior prediction model to perform click behavior prediction, and obtaining a click behavior prediction result.
Optionally, the step of generating a historical access behavior sequence according to the historical access behavior data includes: and generating a historical access behavior sequence according to the historical access behavior data by adopting a preset time interval, inputting the historical access behavior sequence into a click behavior prediction model for click behavior prediction, and obtaining a click behavior prediction result.
The preset time interval may be 5 seconds, 10 seconds, 20 seconds, 30 seconds, 1 minute, 2 minutes, and is not specifically limited herein.
Historical access behavior data, namely historical access behavior data of the mobile terminal corresponding to the mobile terminal opening request. Access behavior data includes, but is not limited to: access time, module identification, function identification, page identification.
The module identification may be an identification of a software module uniquely identified by a module name, module ID, etc. Each software module includes at least one software function, each software function including at least one HTML5 page.
The function identifier may be an identifier that uniquely identifies a software function, such as a function name, a function ID, etc.
The page identity may be an identity uniquely identifying an HTML5 page, such as a page name, page ID, etc. HTML5 page, i.e. HTML5 page.
Optionally, the module identifier, the function identifier, the page name or the page ID are adopted to splice in turn, so as to obtain the page identifier.
The click behavior prediction model is a model obtained based on convolutional neural network training.
And S3, determining a page identifier to be updated according to the click behavior prediction result, acquiring an HTML5 resource from a server by the page identifier to be updated, taking the acquired HTML5 resource as the HTML5 resource to be initialized, namely H5 resource, and replacing the HTML5 resource to be initialized with the HTML5 resource in a local cache according to the page identifier.
HTML5 resources, i.e., resources for which HTML5 pages are displayed. HTML5 resources include, but are not limited to: CSS (cascading style sheet), text data, picture resources, audio resources, video resources.
The local cache refers to a local cache corresponding to the mobile terminal.
Optionally, an HTML5 resource of a page identifier is obtained from the server, and then the HTML5 resource of the page identifier is replaced with the HTML5 resource corresponding to the page identifier in the local cache, so that the local cache is updated while obtaining.
For S4, a page load request sent by the user may be obtained, or may be a page load request sent by a third party application system.
Page load requests, i.e. requests to open HTML5 pages at the mobile end.
The page identifier to be loaded is the page identifier of the HTML5 page which needs to be opened at the mobile terminal by the page loading request.
For S5, responding to the page loading request, and judging whether the HTML5 resource corresponding to the page identifier to be loaded in the local cache is the same as the HTML5 resource in the server through the version number of the page identifier to be loaded in the local cache and the version number of the server; when the version number of the page identifier to be loaded in the local cache is the same as that of the page identifier at the server, determining that the judging result is the same as that at the server, otherwise, determining that the judging result is different from that at the server; when the judging result is the same as that of the server, the HTML5 resource corresponding to the page identifier to be loaded in the local cache can be directly used as the HTML5 resource to be loaded, so that timeliness of loading the HTML5 resource is improved, and user experience is improved; and when the judging result is different from that of the server, acquiring the HTML5 resource from the server by the page identifier to be loaded, and taking the acquired HTML5 resource as the HTML5 resource to be loaded.
Optionally, the page identifier to be loaded is obtained from the server to obtain the HTML5 resource, and the local cache is updated according to the obtained HTML5 resource.
For S6, responding to the page loading request, searching the page identifier to be loaded in the click behavior prediction result, and taking all page identifiers of preset click progression corresponding to the page identifiers searched in the click behavior prediction result as page identifier prediction results of the next step; and determining a page identifier needing to be updated in advance according to a page identifier prediction result of the next step, acquiring an HTML5 resource from a server according to the page identifier needing to be updated in advance, and updating the acquired HTML5 resource to the local cache.
It will be appreciated that step S5 and step S6 may be performed synchronously or asynchronously, and are not specifically limited herein.
And S7, loading and rendering the HTML5 resource to be loaded in the page of the mobile terminal, and taking the HTML5 page obtained after loading and rendering as a target HTML5 page.
In one embodiment, before the step of predicting the click behavior of the historical access behavior data by using the click behavior prediction model to obtain a click behavior prediction result, the method includes:
S021: obtaining a plurality of training samples, the training samples comprising: accessing behavior sequence sample data;
s022: dividing the training samples according to a preset dividing rule to obtain a training set and a verification set;
s023: training the model to be trained by adopting the training set to obtain a model to be verified, wherein the model to be trained comprises: the device comprises a convolution layer, a p-Max pooling layer, an activation layer and a full connection layer;
s024: verifying the model to be verified by adopting the verification set to obtain a verification result;
s025: when the verification result is failure, carrying out parameter updating on the model to be verified according to the verification result to obtain the model to be trained, and repeatedly executing the step of training the model to be trained by adopting the training set to obtain the model to be verified until the verification result is successful;
s026: and determining the model to be verified, of which the verification result is successful, as the click behavior prediction model.
The embodiment realizes that the click behavior prediction model is obtained based on convolutional neural network training, and provides a basis for click behavior prediction according to the operation habit of the user, so that the HTML5 resource in the local cache is more in line with the operation habit of the user when the mobile terminal is started, and the timeliness of loading the HTML5 resource is improved and the user experience is improved under the condition that the comprehensive update is not needed.
For S021, a plurality of training samples may be obtained from the database, or may be a plurality of training samples input by the user, or may be a plurality of training samples sent by the third party application system.
The access behavior sequence sample data is sequence data obtained according to the access behavior data.
For S022, each training sample of the plurality of training samples is divided into a training set and a verification set according to a preset division rule. It will be appreciated that the same training sample can only be divided into one of the training set and the validation set.
Preset partitioning rules include, but are not limited to: dividing according to a preset proportion.
For S023, training a model to be trained by adopting the training set based on the gradient lifting decision tree GBDT. The training principle and process of the gradient boosting decision tree are not described in detail herein.
The model to be trained is a model obtained based on convolutional neural network training. The model to be trained comprises: a convolution layer, a p-Max pooling layer, an activation layer and a full connection layer. And the convolution layer is used for extracting the characteristics. The p-Max pooling layer, i.e., the flexible pooling layer, is used to select the p most critical features, preserve the relative order of the p most critical features, and play a critical role in sequential click prediction. And an activation layer which adopts a nonlinear function. The convolution layer, the p-Max pooling layer and the activation layer output first-order feature maps, and repeated times of the convolution layer, the p-Max pooling layer and the activation layer generate a plurality of first-order feature maps.
For S024, the method for verifying the model to be verified by using the verification set may be selected from the prior art, which is not described herein in detail.
For S025, when the verification result is failure, it means that the model to be verified is not trained to be optimal, and at this time, parameter updating is performed on the model to be verified according to the verification result to obtain the model to be trained, and steps S023 to S025 are repeated until the verification result is successful.
The method for updating the parameters of the model to be verified according to the verification result may be selected from the prior art, which is not described herein.
For S026, when the verification result is successful, it means that the model to be verified has been trained to be optimal, at which time the model to be verified whose verification result is successful may be taken as the click behavior prediction model.
In one embodiment, the step of obtaining the HTML5 resource to be initialized sent by the server according to the click behavior prediction result includes:
s31: acquiring page identifiers from the click behavior prediction result by adopting preset duration to obtain a predicted click page identifier set;
S32: acquiring a version number from the local cache according to the page identification set clicked by prediction to obtain a first local version number set;
s33: acquiring a version number from the server according to the page identification set clicked by prediction to obtain a first server version number set;
s34: comparing version numbers of the same page identifier according to the first local version number set and the first server version number set to obtain a plurality of first comparison results;
s35: when the first comparison results are different, the page identifier corresponding to the first comparison results is used as a page identifier to be initialized;
s36: obtaining a page identification set to be initialized according to all the page identifications to be initialized;
s37: and acquiring the HTML5 resource from the server according to the page identification set to be initialized, and obtaining the HTML5 resource to be initialized.
According to the method and the device for loading the HTML5 resources, the HTML5 resources to be initialized, which are sent by the server side, are obtained according to the click behavior prediction result, so that the HTML5 resources to be initialized accord with the operation habit of a user, and the timeliness of loading the HTML5 resources is improved and the user experience is improved under the condition that comprehensive updating is not needed.
And S31, starting to acquire from the beginning part of the click behavior prediction result, acquiring page identifiers within a preset duration, and taking all acquired page identifiers as a page identifier set for predicting clicking.
And S32, respectively acquiring a version number from the local cache by each page identifier in the page identifier set clicked by prediction, taking each acquired version number as a first local version number, and taking all first local version numbers as a first local version number set.
And S33, respectively acquiring a version number from the server by each page identifier in the predicted click page identifier set, taking each acquired version number as a first server version number, and taking all the first server version numbers as a first server version number set.
For S34, acquiring a page identifier from a page identifier set of the predicted click as a target page identifier; comparing the first local version number corresponding to the target page identifier with the first server version number corresponding to the target page identifier, and determining that the first comparison result corresponding to the target page identifier is the same when the first local version number corresponding to the target page identifier is the same as the first server version number corresponding to the target page identifier, otherwise, determining that the first comparison result corresponding to the target page identifier is different; and repeatedly executing the step of acquiring one page identifier from the page identifier set of the predicted click as a target page identifier until determining a first comparison result corresponding to each page identifier in the page identifier set of the predicted click. That is, the number of first comparison results is the same as the number of page identifications in the set of page identifications of the predicted clicks.
For S35, when the first comparison result is different, it means that the version number of the page identifier corresponding to the first comparison result in the local cache is different from the version number of the server, and at this time, the HTML5 resource of the page identifier corresponding to the first comparison result in the local cache is not the same as that of the server, so that the page identifier corresponding to the first comparison result is used as the page identifier to be initialized.
And for S36, taking all the page identifications to be initialized as a page identification set to be initialized.
And for S37, acquiring HTML5 resources from the server according to each page identifier to be initialized in the page identifier set to be initialized, and taking all the acquired HTML5 resources as the HTML5 resources to be initialized.
In one embodiment, the step of obtaining the page identifier set of the predicted click from the predicted click behavior result by using the preset duration includes:
s311: acquiring page classification data, preset initialization progression and preset duration;
s312: and acquiring the page identifier from the click behavior prediction result by adopting the page classification data, the preset initialization level and the preset duration to obtain a page identifier set for predicting clicking.
According to the method and the device for achieving the webpage identification, the page identification is obtained from the click behavior prediction result according to the webpage classification data, the preset initialization level number and the preset duration, so that the number of HTML5 resources required to be updated when the mobile terminal is started is reduced under the condition that the user webpage loading requirement is met, the starting speed of the mobile terminal is improved, and the user experience is improved.
For S311, the page classification data may be obtained from a database, or may be page classification data input by a user, or may be page classification data sent by a third party application system. It will be appreciated that page ranking data may be written in a program file embodying the present application.
The preset initialization level number can be obtained from a database, can be input by a user, and can be sent by a third party application system. It can be appreciated that the preset initialization progression may be written into a program file implementing the present application.
The preset duration can be obtained from a database, can be input by a user, and can be sent by a third party application system. It can be appreciated that the preset duration may be written into a program file implementing the present application.
The page ranking data includes: module identification, function identification, first-level page identification, second-level page identification, third-level page identification and fourth-level page identification. The page identifications of the first level, the page identifications of the second level, the page identifications of the third level and the page identifications of the fourth level are all page identifications.
The preset initialization level is a specific value.
For S312, starting to acquire from the beginning part of the click behavior prediction result, acquiring page identifiers within a preset duration, and taking all acquired page identifiers as a page identifier set to be extracted; and acquiring page identifiers of a preset initialization level number from a page identifier set to be extracted by adopting the page classification data, and taking all the acquired page identifiers as the page identifier set clicked by prediction.
In one embodiment, the step of determining whether the HTML5 resource corresponding to the page identifier to be loaded in the local cache is the same as that in the server side, to obtain a determination result includes:
s51: acquiring a version number from the local cache according to the page identifier to be loaded to obtain a second local version number;
S52: acquiring a version number from the server according to the page identifier to be loaded to obtain a second server version number;
s53: and when the second local version number is the same as the second server version number, determining that the judging result is the same as the server, otherwise, determining that the judging result is different from the server.
The method and the device for loading the HTML5 data in the local cache realize judging whether the HTML5 data in the local cache is the same as the HTML5 data in the server, so that a basis is provided for preferentially loading the HTML5 data in the local cache, timeliness of loading the HTML5 resources is improved, and user experience is improved.
And for S51, searching the version number in the local cache by the page identifier to be loaded, and taking the searched version number as a second local version number.
And for S52, searching the version number in the server by the page identifier to be loaded, and taking the searched version number as a second server version number.
For S53, when the second local version number is the same as the second server version number, which means that the HTML5 resource of the page identifier to be loaded in the local cache is the same as that in the server, it may be determined that the determination result is the same as that in the server; when the second local version number is different from the second server version number, which means that the HTML5 resource of the page identifier to be loaded in the local cache is not the same as that in the server, the determination result may be determined to be different from that in the server.
In one embodiment, the step of performing a preset click progression page expansion prediction according to the page identifier to be loaded and the click behavior prediction result to obtain a page identifier prediction result of a next step, and updating the local cache according to the page identifier prediction result of the next step includes:
s61: searching the page identifier to be loaded in the click behavior prediction result, and taking all page identifiers of preset click progression corresponding to the page identifiers searched in the click behavior prediction result as page identifier prediction results of the next step;
s62: acquiring a version number from the local cache according to each page identifier in the page identifier prediction result of the next step to obtain a third local version number set;
s63: acquiring a version number from the server according to each page identifier in the page identifier prediction result of the next step respectively to obtain a third server version number set;
s64: comparing version numbers of the same page identifier according to the third local version number set and the third server version number set to obtain a plurality of second comparison results;
S65: when the second comparison results are different, the page identifier corresponding to the second comparison results is used as a preset click progression page identifier to be updated;
s66: obtaining a preset click progression page identification set to be updated according to all the preset click progression page identifications to be updated;
s67: acquiring an HTML5 resource from the server according to the preset click progression page identification set to be updated to obtain the preset click progression page HTML5 resource to be updated;
s68: and updating the local cache according to the HTML5 resource of the page with the preset click level to be updated.
According to the method and the device, the HTML5 resources of the preset click level pages are stored in the local cache in advance according to the operation of the user, and the timeliness of loading the HTML5 resources is further improved.
For S61, the preset click progression is a specific value. The preset number of click stages includes, but is not limited to: 1. 2, 3 and 4.
And S62, respectively acquiring a version number of each page identifier in the page identifier prediction result of the next step in the local cache, taking each acquired version number as a third local version number, and taking all third local version numbers as a third local version number set.
And S63, respectively acquiring a version number of each page identifier in the page identifier prediction result of the next step in the server, taking each acquired version number as a third server version number, and taking all third server version numbers as a third server version number set.
For S64, a page identifier is obtained from the page identifier prediction result of the next step and is used as the page identifier to be updated; comparing the third local version number corresponding to the page identifier to be updated with the third server version number corresponding to the page identifier to be updated, and determining that the second comparison result corresponding to the page identifier to be updated is the same when the third local version number corresponding to the page identifier to be updated is the same as the third server version number corresponding to the page identifier to be updated, otherwise, determining that the second comparison result corresponding to the page identifier to be updated is different; and repeatedly executing the step of acquiring a page identifier from the page identifier prediction result of the next step as the page identifier to be updated until determining second comparison results corresponding to the page identifiers in the page identifier prediction result of the next step. That is, the number of second comparison results is the same as the number of page identifications in the page identification prediction result of the next step.
For S65, when the second comparison result is different, it means that the version number of the page identifier corresponding to the second comparison result in the local cache is different from the version number of the server, and at this time, the HTML5 resource of the page identifier corresponding to the second comparison result in the local cache is not the same as that of the server, so that the page identifier corresponding to the second comparison result is used as the page identifier of the preset click number to be updated.
And S66, taking all the preset click level page identifiers to be updated as a preset click level page identifier set to be updated.
And S67, acquiring HTML5 resources from the server according to each preset click progression page identifier to be updated in the preset click progression page identifier set to be updated, and taking all the acquired HTML5 resources as the HTML5 resources of the preset click progression page to be updated.
In an embodiment, after the step of obtaining the mobile terminal opening request, the method further includes:
s81: acquiring a large-batch page update request sent by the server;
s82: responding to the page mass updating request to acquire network type data;
S83: when the network type data is WIFI or 5G, acquiring an HTML5 resource compression packet sent by the server to obtain a large amount of HTML5 resources to be updated;
s84: decompressing the large amount of HTML5 resources to be updated to obtain decompressed HTML5 resources;
s85: and updating the local cache according to the decompressed HTML5 resource.
The embodiment realizes the mass update of the page HTML5 resources in the WIFI or 5G process, and improves the update speed; when the version is updated, the HTML5 resource in the local cache can be directly updated, and the release speed of the version is improved.
And S81, acquiring a large-batch page update request sent by the server through communication connection between the mobile terminal and the server.
The page mass update request refers to a request for mass updating of HTML5 resources.
And for S82, responding to the page mass update request, and acquiring network type data of the mobile electronic equipment of the loading mobile terminal.
Network type data includes, but is not limited to: WIFI, 5G (fifth generation mobile communication technology), 4G (fourth generation mobile communication technology), 3G (third generation mobile communication technology).
For S83, when the network type data is WIFI or 5G, this means that the network speed of the mobile electronic device where the mobile terminal is located is relatively high, and the downloading speed of the HTML5 resources in large batches is relatively high, and the internet surfing experience of the user is not affected; and sending a mass download signal to the server, acquiring an HTML5 resource compression packet sent by the server according to the mass download signal, and taking the acquired HTML5 resource compression packet as a mass of HTML5 resources to be updated.
And for S84, decompressing the large amount of HTML5 resources to be updated, and taking the decompressed HTML5 resources as decompressed HTML5 resources.
Referring to fig. 2, the application further provides a loading device of HTML5 page resources, where the device includes:
a first request obtaining module 100, configured to obtain a mobile terminal opening request;
the click behavior prediction module 200 is configured to respond to the mobile terminal opening request, obtain historical access behavior data, and perform click behavior prediction on the historical access behavior data by using a click behavior prediction model to obtain a click behavior prediction result;
the local initialization updating module 300 is configured to obtain, according to the click behavior prediction result, an HTML5 resource to be initialized sent by a server, and update a local cache according to the HTML5 resource to be initialized;
a second request obtaining module 400, configured to obtain a page loading request, where the page loading request carries a page identifier to be loaded;
the page loading module 500 is configured to determine whether an HTML5 resource corresponding to the page identifier to be loaded in the local cache is the same as that in the server, and obtain a determination result, when the determination result is the same as that in the server, take the HTML5 resource corresponding to the page identifier to be loaded in the local cache as the HTML5 resource to be loaded, otherwise, obtain the HTML5 resource from the server as the HTML5 resource to be loaded according to the page identifier to be loaded;
Responding to the page loading request 600, judging to respond to the page loading request, and carrying out preset click level page expansion prediction according to the page identifier to be loaded and the click behavior prediction result to obtain a page identifier prediction result of the next step, and updating the local cache according to the page identifier prediction result of the next step;
and the target HTML5 page determining module 700 is configured to load and render a page according to the HTML5 resource to be loaded, so as to obtain a target HTML5 page.
According to the method, historical access behavior data are obtained by responding to a mobile terminal opening request, clicking behavior prediction is conducted on the historical access behavior data through a clicking behavior prediction model, clicking behavior prediction results are obtained, HTML5 resources to be initialized, which are sent by a server terminal, are obtained according to the clicking behavior prediction results, a local cache is updated according to the HTML5 resources to be initialized, whether the HTML5 resources corresponding to page identifiers to be loaded in the local cache are the same as those of the server terminal or not is judged according to page loading requests, judging results are obtained, when judging results are the same as those of the server terminal, the HTML5 resources corresponding to the page identifiers to be loaded in the local cache are used as the HTML5 resources to be loaded, otherwise, the HTML5 resources are obtained from the server terminal according to the page identifiers to be loaded and are used as the HTML5 resources to be loaded, loading and rendering of pages are conducted according to the HTML5 resources to be loaded, and therefore the HTML5 resources in the local cache are enabled to be more consistent with operation habits of users, timeliness of loading the HTML5 resources is improved, and user experience is improved under the condition that comprehensive updating is not needed; according to the method, a page loading request is responded, a preset click level page expansion prediction is conducted according to a page identifier to be loaded and a click behavior prediction result, a page identifier prediction result of the next step is obtained, a local cache is updated according to the page identifier prediction result of the next step, HTML5 resources of the preset click level page are stored in the local cache in advance according to user operation, and timeliness of loading the HTML5 resources is further improved; therefore, the method and the device solve the technical problems of traffic resource waste and slow loading at the same time, and improve user experience.
Referring to fig. 3, a computer device is further provided in the embodiment of the present application, where the computer device may be a server, and the internal structure of the computer device may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing data such as loading methods of HTML5 page resources. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method of loading HTML5 page resources. The loading method of the HTML5 page resource comprises the following steps: acquiring a mobile terminal starting request; responding to the mobile terminal starting request, acquiring historical access behavior data, and carrying out click behavior prediction on the historical access behavior data by adopting a click behavior prediction model to obtain a click behavior prediction result; acquiring an HTML5 resource to be initialized sent by a server according to the click behavior prediction result, and updating a local cache according to the HTML5 resource to be initialized; acquiring a page loading request, wherein the page loading request carries a page identifier to be loaded; responding to the page loading request, judging whether the HTML5 resource corresponding to the page identifier to be loaded in the local cache is the same as that in the server side, obtaining a judging result, taking the HTML5 resource corresponding to the page identifier to be loaded in the local cache as the HTML5 resource to be loaded when the judging result is the same as that in the server side, otherwise, acquiring the HTML5 resource from the server side as the HTML5 resource to be loaded according to the page identifier to be loaded; responding to the page loading request, carrying out preset click level page expansion prediction according to the page identifier to be loaded and the click behavior prediction result to obtain a page identifier prediction result of the next step, and updating the local cache according to the page identifier prediction result of the next step; and loading and rendering the page according to the HTML5 resource to be loaded to obtain a target HTML5 page.
According to the method, historical access behavior data are obtained by responding to a mobile terminal opening request, clicking behavior prediction is conducted on the historical access behavior data through a clicking behavior prediction model, clicking behavior prediction results are obtained, HTML5 resources to be initialized, which are sent by a server terminal, are obtained according to the clicking behavior prediction results, a local cache is updated according to the HTML5 resources to be initialized, whether the HTML5 resources corresponding to page identifiers to be loaded in the local cache are the same as those of the server terminal is judged according to page loading requests, judging results are obtained, when judging results are the same as those of the server terminal, the HTML5 resources corresponding to the page identifiers to be loaded in the local cache are used as the HTML5 resources to be loaded, otherwise, the HTML5 resources to be loaded are obtained from the server terminal according to the page identifiers to be loaded, loading and rendering of the page are conducted according to the HTML5 resources to be loaded, and therefore the HTML5 resources in the local cache are more consistent with operation habits of users, timeliness of loading the HTML5 resources is improved under the condition that comprehensive updating is not needed, and user experience is improved; according to the method, a page loading request is responded, a preset click level page expansion prediction is conducted according to a page identifier to be loaded and a click behavior prediction result, a page identifier prediction result of the next step is obtained, a local cache is updated according to the page identifier prediction result of the next step, HTML5 resources of the preset click level page are stored in the local cache in advance according to user operation, and timeliness of loading the HTML5 resources is further improved; therefore, the method and the device solve the technical problems of traffic resource waste and slow loading at the same time, and improve user experience.
An embodiment of the present application further provides a computer readable storage medium having a computer program stored thereon, which when executed by a processor implements a method for loading HTML5 page resources, including the steps of: acquiring a mobile terminal starting request; responding to the mobile terminal starting request, acquiring historical access behavior data, and carrying out click behavior prediction on the historical access behavior data by adopting a click behavior prediction model to obtain a click behavior prediction result; acquiring an HTML5 resource to be initialized sent by a server according to the click behavior prediction result, and updating a local cache according to the HTML5 resource to be initialized; acquiring a page loading request, wherein the page loading request carries a page identifier to be loaded; responding to the page loading request, judging whether the HTML5 resource corresponding to the page identifier to be loaded in the local cache is the same as that in the server side, obtaining a judging result, taking the HTML5 resource corresponding to the page identifier to be loaded in the local cache as the HTML5 resource to be loaded when the judging result is the same as that in the server side, otherwise, acquiring the HTML5 resource from the server side as the HTML5 resource to be loaded according to the page identifier to be loaded; responding to the page loading request, carrying out preset click level page expansion prediction according to the page identifier to be loaded and the click behavior prediction result to obtain a page identifier prediction result of the next step, and updating the local cache according to the page identifier prediction result of the next step; and loading and rendering the page according to the HTML5 resource to be loaded to obtain a target HTML5 page.
According to the loading method of the HTML5 page resource, the historical access behavior data is obtained by responding to the starting request of the mobile terminal, the clicking behavior prediction is carried out on the historical access behavior data by adopting the clicking behavior prediction model, the clicking behavior prediction result is obtained, the HTML5 resource to be initialized sent by the server terminal is obtained according to the clicking behavior prediction result, the local cache is updated according to the HTML5 resource to be initialized, whether the HTML5 resource corresponding to the page identifier to be loaded in the local cache is the same as the HTML5 resource to be loaded in the server terminal is judged according to the page loading request, when the judging result is the same as the HTML5 resource to be loaded in the server terminal, otherwise, the HTML5 resource is obtained from the server terminal according to the page identifier to be loaded as the HTML5 resource to be loaded, and the loading and rendering of the page are carried out according to the HTML5 resource to be loaded, so that the HTML5 resource in the local cache is more in line with the operation habit of a user, the timeliness of loading the HTML5 resource is improved under the condition that the overall updating is not needed, and the user experience is improved; according to the method, a page loading request is responded, a preset click level page expansion prediction is conducted according to a page identifier to be loaded and a click behavior prediction result, a page identifier prediction result of the next step is obtained, a local cache is updated according to the page identifier prediction result of the next step, HTML5 resources of the preset click level page are stored in the local cache in advance according to user operation, and timeliness of loading the HTML5 resources is further improved; therefore, the method and the device solve the technical problems of traffic resource waste and slow loading at the same time, and improve user experience.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.