Browser code block loading method and device, equipment, medium and program product
By predicting the next accessed module in the browser and generating corresponding polyfill code blocks, the excessive page loading burden caused by loading all patch code blocks at one time in the prior art is solved, and more efficient resource loading and updates are achieved, improving page performance and user experience.
Patent Information
- Application Number
- CN202411748863.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-12-02
AI Technical Summary
When loading a global WAN page, the existing technology will load all patch code blocks at once, resulting in the polyfill resources not required by the current application page or module being invalidated, increasing the loading burden of the page.
By obtaining the identification information of the first module in the target system currently accessed by the target browser, predicting and determining the identification information of the next module, based on this, a list of polyfill code blocks that do not support the target browser is generated, and these code blocks are output only when the predicted next module is consistent with the actually accessed module.
It realizes more efficient and flexible polyfill code block loading and updating, which reduces page loading burden, reduces resource consumption, improves page loading speed, and improves the overall performance and user experience of web page applications.
Smart Images

Figure CN119576437A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a browser code block loading method, device, equipment, medium and program product. Background Art
[0002] When users access a browser, they usually use the Single Page Application (SPA) development model. After the initial loading, there is no need to reload the entire browser page. Instead, different views and functions are displayed through asynchronous updates and dynamic replacement of part of the page content. When loading a World Wide Web (WEB) page, the code block loading method in the related art will load all the polyfill code blocks at once, and the polyfill resources required by non-current application pages or modules will also be loaded invalidly. It is impossible to combine the characteristics of asynchronous loading and dynamic rendering in SPA, which increases the burden of page loading. Summary of the invention
[0003] The embodiments of the present application provide a browser code block loading method, device, equipment, medium and program product to solve the problem of excessive page loading burden of code block loading of web pages in the related art.
[0004] To solve the above technical problems, this application is implemented as follows:
[0005] In a first aspect, an embodiment of the present application provides a browser code block loading method, comprising:
[0006] Acquire first identification information of a first module in a target system currently accessed by a target browser, and determine second identification information based on the first identification information, wherein the target system is a system on which the target browser runs, the second identification information is identification information corresponding to a second module, and the second module is a next module to be accessed by the target browser predicted based on the first module;
[0007] Determine, according to the first corresponding relationship, a first new feature list corresponding to the second identification information, and filter out a second new feature list that does not support the target browser from the first new feature list corresponding to the second identification information; wherein the first corresponding relationship is a corresponding relationship between the identification information of each module in the target system and the first new feature list corresponding to each module;
[0008] When the second identification information is consistent with the identification information of the third module, the patch polyfill code block corresponding to the second new feature list is output to the target browser, wherein the third module is the next module actually accessed by the target browser.
[0009] Optionally, the method further comprises:
[0010] Obtain code files of each module in the target system;
[0011] Preprocessing the code files of each module in the target system to obtain the first new feature list corresponding to each module in the target system;
[0012] When the target browser accesses the target system, obtaining identification information corresponding to each module in the target system; wherein each module in the target system corresponds to one identification information, and the identification information corresponding to any two modules in the target system are different;
[0013] According to the identification information corresponding to each module in the target system and the first new feature list corresponding to each module in the target system, a correspondence between the identification information of each module in the target system and the first new feature list corresponding to each module is generated to obtain the first correspondence.
[0014] Optionally, determining the second identification information based on the first identification information includes:
[0015] Inputting identification information of each module in the target system into a prediction model, obtaining first output information output by the prediction model, wherein the first output information includes identification information of a predicted access module corresponding to the target module, the predicted access module being the next module to be accessed when the target browser currently accesses the target module, and the target module being any module in the target system;
[0016] Generate a module configuration file according to the identification information of the predicted access module corresponding to each module in the target system;
[0017] Based on the first identification information, the second module accessed by the target browser is predicted from the module configuration file to obtain the second identification information.
[0018] Optionally, the method further comprises:
[0019] Based on the embedding code pre-implanted in the target system, first interaction data between modules in the target system is obtained, where the first interaction data includes identification information of at least one module in the target system that is successively accessed by the target browser;
[0020] Preprocessing the interaction data to obtain second interaction data;
[0021] The pre-constructed hidden Markov model is trained using the second interaction data to obtain the prediction model, wherein the observation values in the hidden Markov model correspond to the identification information of the module in the target system.
[0022] Optionally, when the second identification information is consistent with the identification information of the third module, outputting the polyfill code block corresponding to the second new feature list to the target browser includes:
[0023] When the second identification information is consistent with the identification information of the third module, generating a polyfill code block corresponding to the at least one first new feature according to the at least one first new feature in the second new feature list;
[0024] Assembling polyfill code blocks corresponding to the at least one first new feature to generate a target file;
[0025] The target file is loaded into the target browser.
[0026] Optionally, generating a polyfill code block corresponding to at least one first new feature according to at least one first new feature in the second new feature list includes:
[0027] Traversing each first new property in the second new property list;
[0028] When the target new feature exists in the second new feature list, obtaining a polyfill code block corresponding to the target new feature from the cache of the target system; wherein the target new feature is a first new feature for which a corresponding polyfill code block is pre-stored in the cache of the target system;
[0029] Generate polyfill code blocks corresponding to other first new features except the target new feature in the second new feature list, wherein the polyfill code blocks corresponding to the at least one first new feature include polyfill code blocks corresponding to other first new features except the target new feature.
[0030] Optionally, when the second identification information is inconsistent with the identification information of the third module, the method further includes:
[0031] According to the third identification information of the third module, the type information and the version information of the target system, filtering out a third new feature list that does not support the target browser from the first new feature list corresponding to the third identification information;
[0032] According to at least one second new feature in the third new feature list, generate a polyfill code block corresponding to the at least one second new feature;
[0033] Outputting a polyfill code block corresponding to the at least one second new feature to the target browser.
[0034] In a second aspect, the embodiment of the present application further provides a browser code block loading device, including:
[0035] An acquisition prediction module is used to acquire first identification information of a first module in a target system currently accessed by a target browser, and determine second identification information based on the first identification information, wherein the target system is a system on which the target browser runs, the second identification information is identification information corresponding to a second module, and the second module is a next module to be accessed by the target browser predicted based on the first module;
[0036] Determine a screening module, which is used to determine the first new feature list corresponding to the second identification information according to the first corresponding relationship, and screen out the second new feature list that does not support the target browser from the first new feature list corresponding to the second identification information; wherein the first corresponding relationship is the corresponding relationship between the identification information of each module in the target system and the first new feature list corresponding to each module;
[0037] A code block output module is used to output the polyfill code block corresponding to the second new feature list to the target browser when the second identification information is consistent with the identification information of the third module, wherein the third module is the next module actually accessed by the target browser.
[0038] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the browser code block loading method described in the first aspect.
[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the browser code block loading method described in the first aspect are implemented.
[0040] According to a fifth aspect, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0041] In an embodiment of the present application, by obtaining the first identification information of the first module in the target system currently accessed by the target browser, the second identification information of the second module is determined based on the first identification information, and based on this, the prediction of the next module accessed by the target browser by the currently accessed first module is implemented. Subsequently, according to the correspondence between the identification information of each module in the target system and the first new feature list corresponding to each module, the first new feature list corresponding to the second identification information is determined, and the second new feature list that does not support the target browser is filtered out from the first new feature list corresponding to the second identification information. In this way, when the predicted second module is consistent with the third module actually accessed by the target browser, the polyfill code block corresponding to the second new feature list can be directly output to the target browser without loading all the polyfill code blocks, and the polyfill code blocks can be loaded and updated more efficiently and flexibly, reducing the page load burden, reducing resource consumption, increasing page loading speed, and improving the overall performance and user experience of web page applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0043] Figure 1 This is one of the flow charts of a browser code block loading method provided in an embodiment of the present application;
[0044] Figure 2 This is the second flowchart of a browser code block loading method provided in an embodiment of the present application;
[0045] Figure 3 It is a structural schematic diagram of a browser code block loading device provided in an embodiment of the present application;
[0046] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] See also Figure 1 , Figure 1 This is one of the flowcharts of a browser code block loading method provided in an embodiment of the present application, the method comprising the following steps:
[0049] Step 101, obtain first identification information of a first module in a target system currently accessed by a target browser, and determine second identification information based on the first identification information, wherein the target system is a system in which the target browser runs, and the second identification information is identification information corresponding to a second module, and the second module is a next module to be accessed by the target browser predicted based on the first module.
[0050] It should be noted that the target browser may be a browser for loading various web pages, and may be applied to various terminal devices, such as mobile phones, tablet computers, laptop computers, notebook computers, personal digital assistants (PDA), PDAs, netbooks, ultra-mobile personal computers (UMPC), mobile Internet devices (MID), augmented reality (AR), virtual reality (VR) devices, robots, wearable devices, flight vehicles, vehicle user equipment (VUE), shipborne equipment, pedestrian user equipment (PUE), smart homes (home equipment with wireless communication functions, etc., which are not specifically limited in this application. In this application, the system accessed by the target browser may be referred to as the target system, and the browser accessing the target system may be referred to as the target browser. The system code of the target system may be run through the target browser, and when the target browser accesses the target system, the identification information of each module in the target system, as well as the type information and version information of the target browser may be obtained.
[0051] It is worth mentioning that in the system code construction phase of the target system, after the system code is written, that is, the modules of the target system are obtained according to the routing table of the system code, and unique identification information can be assigned to each module. A module in the target system can correspond to a view component or page in the routing table, that is, a module can correspond to a component or a single page that can be displayed on the target browser. In the target system, the first page or the first module of the target browser can be configured by defining the root route. When the root link of the target browser to access the target system is uncertain or there is no specific path, the target system can automatically load to the first page or the first module.
[0052] In a specific implementation, when a target browser accesses a page or a module of a target system, the target browser can directly obtain the identification information corresponding to the page or module, and then the target browser can predict the next module to be accessed through the target browser's historical access behavior data or artificial intelligence prediction model, and determine the identification information of the second module that the target browser will access after accessing the current first module. As a result, when the target browser accesses the current first module, the prediction of the next module to be accessed is completed, and resources can be loaded and updated more efficiently and flexibly without loading other modules, reducing page load and page waiting time.
[0053] Step 102: determine the first new feature list corresponding to the second identification information according to the first corresponding relationship, and filter out the second new feature list that does not support the target browser from the first new feature list corresponding to the second identification information; wherein the first corresponding relationship is the corresponding relationship between the identification information of each module in the target system and the first new feature list corresponding to each module.
[0054] Specifically, the first new feature list has multiple new features, and each new feature in the first new feature list can be screened, and new features that are not supported by the target browser (for example, incompatible with the target browser, not in compliance with the standard, etc.) can be eliminated, and the remaining new features can be combined into a second new feature list. In this way, by screening the new features in the first feature list that are not supported by the target browser, the compatibility of the developed functions or modules with the target browser can be ensured, the unsupported new features can be identified and eliminated, the stability of the target system can be enhanced, and adjustments and optimizations can be made accurately for the target browser, and resources can be reasonably allocated.
[0055] Step 103: When the second identification information is consistent with the identification information of the third module, the patch polyfill code block corresponding to the second new feature list is output to the target browser, wherein the third module is the next module actually accessed by the target browser.
[0056] In a specific embodiment of the present application, when the target browser accesses the next module, if the predicted second module is consistent with the third module actually opened by the target browser, the polyfill code blocks corresponding to the pre-generated second new feature list can be loaded into the target browser, so that the target browser runs each polyfill code block. In this way, the loaded polyfill code blocks are only those required for the third module currently being accessed, which avoids the extension of page loading time caused by loading a large amount of irrelevant code at one time, improves the speed of first screen rendering, and also conforms to the asynchronous loading and dynamic rendering characteristics of SPA applications, so that in the process of user navigation and interaction, resource loading and updating can be handled more efficiently and flexibly, reducing the burden of page load, reducing resource consumption, improving page loading speed, and improving the overall performance and user experience of web page applications.
[0057] Optionally, the method further comprises:
[0058] Obtain code files of each module in the target system;
[0059] Preprocessing the code files of each module in the target system to obtain the first new feature list corresponding to each module in the target system;
[0060] When the target browser accesses the target system, obtaining identification information corresponding to each module in the target system; wherein each module in the target system corresponds to one identification information, and the identification information corresponding to any two modules in the target system are different;
[0061] According to the identification information corresponding to each module in the target system and the first new feature list corresponding to each module in the target system, a correspondence between the identification information of each module in the target system and the first new feature list corresponding to each module is generated to obtain the first correspondence.
[0062] In some embodiments, during each system construction phase, by scanning and analyzing the code of each module, a new feature list of each module can be obtained, and a correspondence between the identification information of each module and the new feature list can be established. For the target system, the identification information of each module in the target system is obtained, the first new feature list of each module in the target system is obtained, and a first correspondence between the identification information of each module in the target system and the first new feature list corresponding to each module is established. When accessing the target system through the target browser, after obtaining the second identification information, the first new feature list corresponding to the second identification information can be determined according to the above-mentioned first correspondence. Among them, the first new feature list can be obtained by parsing the abstract syntax tree (Abstract Syntax Tree, AST) corresponding to the code of each module, and then traversing the nodes in the AST.
[0063] In this way, the first corresponding relationship in the embodiment of the present application can accurately locate the first new feature list corresponding to each module, so that the second new feature list can be filtered according to the first new feature list, and only the required polyfill code blocks used by the target system can be loaded according to the second new feature list.
[0064] Optionally, determining the second identification information based on the first identification information includes:
[0065] Inputting identification information of each module in the target system into a prediction model, obtaining first output information output by the prediction model, wherein the first output information includes identification information of a predicted access module corresponding to the target module, the predicted access module being the next module to be accessed when the target browser currently accesses the target module, and the target module being any module in the target system;
[0066] Generate a module configuration file according to the identification information of the predicted access module corresponding to each module in the target system;
[0067] Based on the first identification information, the second module accessed by the target browser is predicted from the module configuration file to obtain the second identification information.
[0068] In some other embodiments, the sequence and probability of the next module that is most likely to be accessed under each currently accessed module are pre-generated based on the prediction model and packaged into a module configuration file. Specifically, for each first module, when the target browser accesses the module, the trained prediction model is called, and the Viterbi algorithm can be used to calculate the sequence and probability of the next module that the target browser may access under the current first module. The specific process is as follows:
[0069] First, the Viterbi table is initialized. For each module (ie, state), the Viterbi table can be initialized at time step t=1, which is usually set to the starting probability of the current access module.
[0070] Secondly, recursive calculation is performed. For each time step t>1 and each module j, the sequence from the starting module to module j after t steps is calculated, and the maximum probability path that the sequence is consistent with the actual module access history of the target browser is observed. Since the observation value in this application is the identification information of the module, the emission probability matrix is integrated with the state transition probability matrix, and the state transition probability matrix can be directly used to represent the probability of transferring from one module to another. The calculation formula can be expressed as:
[0071] V[t][j]=max(V[t-1][i]*A[i][j]);
[0072] Among them, V[t][j] represents the maximum probability of reaching module j at time step t; V[t-1][i] represents the maximum probability of reaching module i at time step t-1; A[i][j] represents the state transition probability from module i to module j.
[0073] Then, the optimal path is backtracked. After calculating all time steps, the state with the highest probability in the last column of the Viterbi table (i.e., time step T) is found. The module corresponding to this state is the module that the user is most likely to access next. By backtracking the Viterbi table, starting from the last time step, the optimal path is searched in reverse, and finally a module access sequence with the highest probability is obtained.
[0074] Finally, the prediction result is obtained. The next module on the optimal path is the module that the target browser is most likely to access next. At the same time, the probability of each module on this path is the probability of the target browser accessing the sequence. In this way, the module configuration file can be obtained through the above process. After determining the first identification information, the second identification information of the second module can be directly obtained by comparing and searching in the module configuration file, thereby predicting the second module that the target browser will access.
[0075] Optionally, the method further comprises:
[0076] Based on the embedding code pre-implanted in the target system, first interaction data between modules in the target system is obtained, where the first interaction data includes identification information of at least one module in the target system that is successively accessed by the target browser;
[0077] Preprocessing the interaction data to obtain second interaction data;
[0078] The pre-constructed hidden Markov model is trained using the second interaction data to obtain the prediction model, wherein the observation values in the hidden Markov model correspond to the identification information of the module in the target system.
[0079] In some specific embodiments of the present application, the next module that the target browser will access is predicted by the prediction module, and the construction process of the prediction module may include: data collection, data preprocessing, model construction and model training. Data collection, that is, the embedding code can be implanted in the Web application to capture the first interaction data of the target browser between each module and the specific module data of each module accessed by the target browser, and these data are sent to the server regularly and stored on the big data platform. It can be understood that the interactive behaviors occurring in the target browser, such as clicks, scrolling, form submissions, etc., can be captured by JavaScript event monitoring and other methods, and the sequence data of the target browser accessing each module can be recorded, which may include the access user identifier (Identifier, ID), access time, identification information of the module accessed at a certain access time, and identification information of the module accessed after the access time, etc.
[0080] Subsequently, the data preprocessing process is to regularly clean the collected first interaction data on the server side, remove outliers and irrelevant items, and organize the first interaction data into an ordered module access sequence, namely the second interaction data. For example, the obtained second interaction data can be a user ID accessing the target browser - [module A identification information, module B identification information, module C identification information, ...].
[0081] Furthermore, the process of constructing the model can correspond the observation values in the Hidden Markov Model (HMM) to the identification information of each module in the target system, and each module can be regarded as a state in the Hidden Markov Model, one module corresponding to one state. The order sequence of the target browser accessing each module is regarded as the observation sequence of the model, and each observation value corresponds to a module ID. Based on the second interaction data obtained from the historical behavior data, the jump probability between each module is counted, and the state transition probability matrix A is constructed, as shown below:
[0082] A=[a ij ] N×N ;
[0083] Where N represents the number of modules in the target system; a ij Indicates the probability that the target browser jumps from module i to module j. Among them, the observation value is the identification information of the corresponding module, and the emission probability matrix B can represent the probability that the target browser visits another module immediately after visiting a certain module, which is integrated with the state transition probability matrix here.
[0084] The construction of the hidden Markov model is completed through the above process. In order to enable the obtained prediction model to accurately predict the access module of the target browser, the hidden Markov model can be trained to make the HMM model better fit the actual behavior pattern of users in Web applications.
[0085] Specifically, the Baum-Welch algorithm can be used for model training. As an effective algorithm specifically used to estimate HMM model parameters, the Baum-Welch algorithm, especially when the observation sequence is known but the model parameters are unknown, gradually adjusts the model parameters through iterative optimization to maximize the conformity with the actual observed user behavior data, which can effectively improve the accuracy of predicting the next module that the user may access. In this application, the behavior sequence (i.e., the second interaction data) of the target browser accessing each module in the Web application can be regarded as the observation sequence of the HMM, and the access pattern between each module can be reflected by the state transition probability matrix of the HMM. The Baum-Welch algorithm uses the collected second interaction data to update and optimize the state transition probability matrix and the emission probability matrix, and obtains the prediction model through continuous iterative training.
[0086] Optionally, when the second identification information is consistent with the identification information of the third module, outputting the polyfill code block corresponding to the second new feature list to the target browser includes:
[0087] When the second identification information is consistent with the identification information of the third module, generating a polyfill code block corresponding to the at least one first new feature according to the at least one first new feature in the second new feature list;
[0088] Assembling polyfill code blocks corresponding to the at least one first new feature to generate a target file;
[0089] The target file is loaded into the target browser.
[0090] In some embodiments, the second identification information is consistent with the identification information of the third module, which means that the second module predicted to be accessed by the target browser is consistent with the third module actually accessed. Then, a polyfill code block corresponding to each new feature can be generated according to the second new feature list corresponding to the second module, and local storage is used for caching. Each polyfill code block is loaded into the target browser so that the target browser runs each polyfill code block.
[0091] Specifically, each polyfill code block can be assembled to generate a JS file, which is then loaded into the target browser to run the JS file. In this way, the loaded polyfill code block is only required for the third module currently being accessed, which avoids the page loading time extension caused by loading a large amount of irrelevant code at one time, reduces the page load burden, reduces resource consumption, increases page loading speed, and improves the overall performance and user experience of web page applications.
[0092] Optionally, generating a polyfill code block corresponding to at least one first new feature according to at least one first new feature in the second new feature list includes:
[0093] Traversing each first new property in the second new property list;
[0094] When the target new feature exists in the second new feature list, obtaining a polyfill code block corresponding to the target new feature from the cache of the target system; wherein the target new feature is a first new feature for which a corresponding polyfill code block is pre-stored in the cache of the target system;
[0095] Generate polyfill code blocks corresponding to other first new features except the target new feature in the second new feature list, wherein the polyfill code blocks corresponding to the at least one first new feature include polyfill code blocks corresponding to other first new features except the target new feature.
[0096] In some embodiments, when the target browser accesses the current first module, the identification information of the next second module to be accessed is obtained according to the module configuration file. The first new feature list corresponding to the module to be accessed is obtained according to the identification information of the second module to be accessed. According to the cached target browser related information, the second new feature list that is not supported by the target browser is filtered out from the first new feature list. In the present application, the second new feature list corresponding to the second module to be accessed can be traversed. If the new feature has been cached in the local storage, the polyfill code block corresponding to the new feature is loaded from the cache, otherwise the polyfill code block corresponding to the new feature is generated and cached using local storage. In this way, the embodiments of the present application can reduce the number of page code blocks loaded, reduce waiting time, improve page update efficiency, and more efficiently and flexibly implement polyfill code block loading and updating, thereby reducing page load.
[0097] Optionally, when the second identification information is inconsistent with the identification information of the third module, the method further includes:
[0098] According to the third identification information of the third module, the type information and the version information of the target system, filtering out a third new feature list that does not support the target browser from the first new feature list corresponding to the third identification information;
[0099] According to at least one second new feature in the third new feature list, generate a polyfill code block corresponding to the at least one second new feature;
[0100] Outputting a polyfill code block corresponding to the at least one second new feature to the target browser.
[0101] In some embodiments, if the predicted second module is inconsistent with the third module actually opened by the target browser, the first new feature list corresponding to the third identification information can be determined from the first corresponding relationship based on the identification information of the third module actually opened, the type information and version information of the target browser, and the third new feature list that does not support the target browser can be filtered out from the first new feature list. Furthermore, the third feature list can be traversed, and if some new features in the third new feature list have been cached in the local storage, the polyfill code blocks corresponding to these new features are loaded from the cache. Otherwise, the polyfill code blocks corresponding to the new features can be directly generated and stored locally, and each polyfill code block can be loaded into the target browser so that the target browser runs each polyfill code block.
[0102] In this way, the embodiments of the present application can reduce the number of page code blocks loaded, reduce waiting time, improve page update efficiency, implement polyfill code block loading and updating more efficiently and flexibly, and reduce page load.
[0103] Please refer to Figure 2 , a browser code block loading method in an embodiment of the present application specifically includes the following steps:
[0104] Step 201: Obtain code files of each module in the target system, and assign corresponding identification information to each module in the target system; each module in the target system corresponds to one identification information, and any two modules in the target system have different corresponding identification information;
[0105] Step 202: preprocess the code files of each module in the target system to obtain the first new feature list corresponding to each module in the target system; generate a correspondence between the identification information of each module in the target system and the first new feature list corresponding to each module to obtain the first correspondence;
[0106] Step 203: input the identification information of each module in the target system into the prediction model, obtain the first output information output by the prediction model, the first output information includes the identification information of the predicted access module corresponding to the target module, the predicted access module is the next module to be accessed when the target browser currently accesses the target module; generate a module configuration file according to the identification information of the predicted access module corresponding to each module in the target system;
[0107] Step 204: whether the module accessed by the target browser is the first module of the target system;
[0108] Step 205: when the module accessed by the target browser is the first module of the target system, obtain the first identification information of the first module, the type information and the version information of the target browser;
[0109] Step 206: if the module accessed by the target browser is not the first module of the target system, obtain the first identification information of the first module in the target system currently accessed by the target browser, the type information and the version information of the target browser;
[0110] Step 207: Based on the first identification information, predict the second module accessed by the target browser from the module configuration file to obtain the second identification information;
[0111] Step 208: determining a first new feature list corresponding to the second identification information according to the first corresponding relationship, and filtering out a second new feature list that is not supported by the target browser from the first new feature list corresponding to the second identification information;
[0112] Step 209: Whether the second identification information is consistent with the identification information of the third module actually accessed by the target browser;
[0113] Step 210: When the second identification information is consistent with the identification information of the third module actually accessed by the target browser, traverse each first new feature in the second new feature list; when the target new feature exists in the second new feature list, obtain a polyfill code block corresponding to the target new feature from the cache of the target system;
[0114] Step 211: When the second identification information is inconsistent with the identification information of the third module actually accessed by the target browser, a third new feature list that is not supported by the target browser is filtered out from the first new feature list corresponding to the third identification information according to the third identification information of the third module, the type information and the version information of the target system; and a corresponding polyfill code block is generated according to at least one second new feature in the third new feature list;
[0115] Step 212: Output the corresponding polyfill code block to the target browser; jump to step 206.
[0116] It is understood that the relevant description of the above embodiment can be found in the above Figure 1 To avoid repetition, the related embodiments shown will not be described again here.
[0117] like Figure 3 As shown, in another embodiment of the present application, a browser code block loading device 300 is disclosed, comprising:
[0118] The acquisition prediction module 301 is used to acquire first identification information of a first module in a target system currently accessed by a target browser, and determine second identification information based on the first identification information, wherein the target system is a system on which the target browser runs, the second identification information is identification information corresponding to a second module, and the second module is a next module accessed by the target browser predicted based on the first module;
[0119] A determination and screening module 302 is used to determine the first new feature list corresponding to the second identification information according to the first corresponding relationship, and screen out the second new feature list that does not support the target browser from the first new feature list corresponding to the second identification information; wherein the first corresponding relationship is the corresponding relationship between the identification information of each module in the target system and the first new feature list corresponding to each module;
[0120] The code block output module 303 is used to output the polyfill code block corresponding to the second new feature list to the target browser when the second identification information is consistent with the identification information of the third module, wherein the third module is the next module actually accessed by the target browser.
[0121] Optionally, the browser code block loading device 300 further includes:
[0122] A first acquisition module, used to acquire code files of various modules in the target system;
[0123] A first processing module, configured to preprocess code files of each module in the target system to obtain the first new feature list corresponding to each module in the target system;
[0124] A second acquisition module is used to acquire identification information corresponding to each module in the target system when the target browser accesses the target system; wherein each module in the target system corresponds to one identification information, and the identification information corresponding to any two modules in the target system is different;
[0125] A relationship generation module is used to generate a correspondence between the identification information of each module in the target system and the first new feature list corresponding to each module according to the identification information corresponding to each module in the target system and the first new feature list corresponding to each module in the target system, so as to obtain the first correspondence.
[0126] Optionally, the prediction acquisition module 301 includes:
[0127] a first acquisition unit, used to input identification information of each module in the target system into a prediction model, and acquire first output information output by the prediction model, wherein the first output information includes identification information of a predicted access module corresponding to the target module, the predicted access module being the next module to be accessed when the target browser currently accesses the target module, and the target module being any module in the target system;
[0128] A first generating unit, configured to generate a module configuration file according to identification information of the predicted access module corresponding to each module in the target system;
[0129] A module prediction unit is used to predict the second module accessed by the target browser from the module configuration file based on the first identification information to obtain the second identification information.
[0130] Optionally, the browser code block loading device 300 further includes:
[0131] A third acquisition module is used to acquire first interaction data between modules in the target system based on the embedding code pre-implanted in the target system, wherein the first interaction data includes identification information of at least one module in the target system that is successively visited by the target browser;
[0132] A second processing module, used for preprocessing the interaction data to obtain second interaction data;
[0133] A model training module is used to perform model training on a pre-built hidden Markov model through the second interaction data to obtain the prediction model, wherein the observation values in the hidden Markov model correspond to the identification information of the module in the target system.
[0134] Optionally, the code block output module 303 includes:
[0135] A second generating unit is configured to generate a polyfill code block corresponding to the at least one first new feature according to the at least one first new feature in the second new feature list when the second identification information is consistent with the identification information of the third module;
[0136] A third generating unit, configured to assemble polyfill code blocks corresponding to the at least one first new feature to generate a target file;
[0137] A file loading unit is used to load the target file into the target browser.
[0138] Optionally, the second generating unit is used for:
[0139] Traversing each first new property in the second new property list;
[0140] When the target new feature exists in the second new feature list, obtaining a polyfill code block corresponding to the target new feature from the cache of the target system; wherein the target new feature is a first new feature for which a corresponding polyfill code block is pre-stored in the cache of the target system;
[0141] Generate polyfill code blocks corresponding to other first new features except the target new feature in the second new feature list, wherein the polyfill code blocks corresponding to the at least one first new feature include polyfill code blocks corresponding to other first new features except the target new feature.
[0142] Optionally, when the second identification information is inconsistent with the identification information of the third module, the browser code block loading device 300 further includes:
[0143] a feature screening module, configured to screen out a third new feature list that is not supported by the target browser from the first new feature list corresponding to the third identification information according to the third identification information of the third module and the type information and version information of the target system;
[0144] A code block generation module, configured to generate a polyfill code block corresponding to at least one second new feature according to at least one second new feature in the third new feature list;
[0145] A code block output module is used to output the polyfill code block corresponding to the at least one second new feature to the target browser.
[0146] It should be noted that this embodiment is Figure 1 The specific implementation of the corresponding device side in the embodiment shown can be found in Figure 1 In order to avoid repeated description, the relevant description of the embodiment shown will not be repeated in this embodiment, and the same beneficial effects can still be achieved.
[0147] See also Figure 4 , Figure 4It is a structural diagram of an electronic device provided in an embodiment of the present application, wherein the electronic device comprises: a processor 400, a memory 420, and a program or instruction stored in the memory 420 and executable on the processor 400, the processor 400 being used to read the program or instruction in the memory 420; the electronic device also comprises a bus interface and a transceiver 410.
[0148] The transceiver 410 is configured to receive and send data under the control of the processor 400 .
[0149] Among them, Figure 4 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 400 and memory represented by memory 420. The bus architecture may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 410 may be a plurality of components, namely, a transmitter and a transceiver, providing a unit for communicating with various other devices on a transmission medium. The processor 400 is responsible for managing the bus architecture and general processing, and the memory 420 may store data used by the processor 400 when performing operations.
[0150] The processor 400 is used to read the program or instruction in the memory 420, and further execute the following steps:
[0151] Acquire first identification information of a first module in a target system currently accessed by a target browser, and determine second identification information based on the first identification information, wherein the target system is a system on which the target browser runs, the second identification information is identification information corresponding to a second module, and the second module is a next module to be accessed by the target browser predicted based on the first module;
[0152] Determine, according to the first corresponding relationship, a first new feature list corresponding to the second identification information, and filter out a second new feature list that does not support the target browser from the first new feature list corresponding to the second identification information; wherein the first corresponding relationship is a corresponding relationship between the identification information of each module in the target system and the first new feature list corresponding to each module;
[0153] When the second identification information is consistent with the identification information of the third module, the patch polyfill code block corresponding to the second new feature list is output to the target browser, wherein the third module is the next module actually accessed by the target browser.
[0154] Optionally, the processor 400 is configured to read a program or instruction in the memory 420, and further execute the following steps:
[0155] Obtain code files of each module in the target system;
[0156] Preprocessing the code files of each module in the target system to obtain the first new feature list corresponding to each module in the target system;
[0157] When the target browser accesses the target system, obtaining identification information corresponding to each module in the target system; wherein each module in the target system corresponds to one identification information, and the identification information corresponding to any two modules in the target system are different;
[0158] According to the identification information corresponding to each module in the target system and the first new feature list corresponding to each module in the target system, a correspondence between the identification information of each module in the target system and the first new feature list corresponding to each module is generated to obtain the first correspondence.
[0159] Optionally, the processor 400 is configured to read a program or instruction in the memory 420 and perform the following steps:
[0160] Inputting identification information of each module in the target system into a prediction model, obtaining first output information output by the prediction model, wherein the first output information includes identification information of a predicted access module corresponding to the target module, the predicted access module being the next module to be accessed when the target browser currently accesses the target module, and the target module being any module in the target system;
[0161] Generate a module configuration file according to the identification information of the predicted access module corresponding to each module in the target system;
[0162] Based on the first identification information, the second module accessed by the target browser is predicted from the module configuration file to obtain the second identification information.
[0163] Optionally, the processor 400 is configured to read a program or instruction in the memory 420, and further execute the following steps:
[0164] Based on the embedding code pre-implanted in the target system, first interaction data between modules in the target system is obtained, where the first interaction data includes identification information of at least one module in the target system that is successively accessed by the target browser;
[0165] Preprocessing the interaction data to obtain second interaction data;
[0166] The pre-constructed hidden Markov model is trained using the second interaction data to obtain the prediction model, wherein the observation values in the hidden Markov model correspond to the identification information of the module in the target system.
[0167] Optionally, the processor 400 is configured to read a program or instruction in the memory 420 and perform the following steps:
[0168] When the second identification information is consistent with the identification information of the third module, generating a polyfill code block corresponding to the at least one first new feature according to the at least one first new feature in the second new feature list;
[0169] Assembling polyfill code blocks corresponding to the at least one first new feature to generate a target file;
[0170] The target file is loaded into the target browser.
[0171] Optionally, the processor 400 is configured to read a program or instruction in the memory 420 and perform the following steps:
[0172] Traversing each first new property in the second new property list;
[0173] When the target new feature exists in the second new feature list, obtaining a polyfill code block corresponding to the target new feature from the cache of the target system; wherein the target new feature is a first new feature for which a corresponding polyfill code block is pre-stored in the cache of the target system;
[0174] Generate polyfill code blocks corresponding to other first new features except the target new feature in the second new feature list, wherein the polyfill code blocks corresponding to the at least one first new feature include polyfill code blocks corresponding to other first new features except the target new feature.
[0175] Optionally, the processor 400 is configured to read a program or instruction in the memory 420 and perform the following steps:
[0176] According to the third identification information of the third module, the type information and the version information of the target system, filtering out a third new feature list that does not support the target browser from the first new feature list corresponding to the third identification information;
[0177] According to at least one second new feature in the third new feature list, generate a polyfill code block corresponding to the at least one second new feature;
[0178] Outputting a polyfill code block corresponding to the at least one second new feature to the target browser.
[0179] It should be noted that the electronic device in the embodiment of the present application can achieve Figure 1 or Figure 2 The various processes implemented in the browser code block loading method embodiment shown can achieve the same beneficial effects, and will not be described again here to avoid repetition.
[0180] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above Figure 1 or Figure 2 The various processes of the browser code block loading method embodiment shown in the figure can achieve the same technical effect, and are not repeated here to avoid repetition. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0181] The present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the above Figure 1 or Figure 2 The various processes of the method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0182] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0183] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0184] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A browser code block loading method, characterized in that: include: Acquire first identification information of a first module in a target system currently accessed by a target browser, and determine second identification information based on the first identification information, wherein the target system is a system on which the target browser runs, and the second identification information is identification information corresponding to a second module, and the second module is a next module to be accessed by the target browser predicted based on the first module; Determine, according to the first corresponding relationship, a first new feature list corresponding to the second identification information, and filter out a second new feature list that does not support the target browser from the first new feature list corresponding to the second identification information; wherein the first corresponding relationship is a corresponding relationship between the identification information of each module in the target system and the first new feature list corresponding to each module; When the second identification information is consistent with the identification information of the third module, the patch polyfill code block corresponding to the second new feature list is output to the target browser, wherein the third module is the next module actually accessed by the target browser.
2. The method according to claim 1, characterized in that The method further comprises: Obtain code files of each module in the target system; Preprocessing the code files of each module in the target system to obtain the first new feature list corresponding to each module in the target system; When the target browser accesses the target system, obtaining identification information corresponding to each module in the target system; wherein each module in the target system corresponds to one identification information, and the identification information corresponding to any two modules in the target system are different; According to the identification information corresponding to each module in the target system and the first new feature list corresponding to each module in the target system, a correspondence between the identification information of each module in the target system and the first new feature list corresponding to each module is generated to obtain the first correspondence.
3. The method according to claim 1, characterized in that The determining the second identification information based on the first identification information includes: Inputting identification information of each module in the target system into a prediction model, obtaining first output information output by the prediction model, wherein the first output information includes identification information of a predicted access module corresponding to the target module, the predicted access module being the next module to be accessed when the target browser currently accesses the target module, and the target module being any module in the target system; Generate a module configuration file according to the identification information of the predicted access module corresponding to each module in the target system; Based on the first identification information, the second module accessed by the target browser is predicted from the module configuration file to obtain the second identification information.
4. The method according to claim 3, characterized in that The method further comprises: Based on the embedding code pre-implanted in the target system, first interaction data between modules in the target system is obtained, where the first interaction data includes identification information of at least one module in the target system that is successively accessed by the target browser; Preprocessing the interaction data to obtain second interaction data; The pre-constructed hidden Markov model is trained using the second interaction data to obtain the prediction model, wherein the observation values in the hidden Markov model correspond to the identification information of the module in the target system.
5. The method according to claim 1, characterized in that When the second identification information is consistent with the identification information of the third module, outputting the polyfill code block corresponding to the second new feature list to the target browser includes: When the second identification information is consistent with the identification information of the third module, generating a polyfill code block corresponding to the at least one first new feature according to the at least one first new feature in the second new feature list; Assembling polyfill code blocks corresponding to the at least one first new feature to generate a target file; The target file is loaded into the target browser.
6. The method according to claim 5, characterized in that The step of generating a polyfill code block corresponding to the at least one first new feature according to the at least one first new feature in the second new feature list includes: Traversing each first new property in the second new property list; When the target new feature exists in the second new feature list, obtaining a polyfill code block corresponding to the target new feature from the cache of the target system; wherein the target new feature is a first new feature for which a corresponding polyfill code block is pre-stored in the cache of the target system; Generate polyfill code blocks corresponding to other first new features except the target new feature in the second new feature list, wherein the polyfill code blocks corresponding to the at least one first new feature include polyfill code blocks corresponding to other first new features except the target new feature.
7. The method according to claim 1, characterized in that When the second identification information is inconsistent with the identification information of the third module, the method further includes: According to the third identification information of the third module, the type information and the version information of the target system, filtering out a third new feature list that does not support the target browser from the first new feature list corresponding to the third identification information; According to at least one second new feature in the third new feature list, generate a polyfill code block corresponding to the at least one second new feature; Outputting a polyfill code block corresponding to the at least one second new feature to the target browser.
8. A browser code block loading device, characterized in that: include: An acquisition prediction module is used to acquire first identification information of a first module in a target system currently accessed by a target browser, and determine second identification information based on the first identification information, wherein the target system is a system on which the target browser runs, the second identification information is identification information corresponding to a second module, and the second module is a next module to be accessed by the target browser predicted based on the first module; Determine a screening module, which is used to determine the first new feature list corresponding to the second identification information according to the first corresponding relationship, and screen out the second new feature list that does not support the target browser from the first new feature list corresponding to the second identification information; wherein the first corresponding relationship is the corresponding relationship between the identification information of each module in the target system and the first new feature list corresponding to each module; A code block output module is used to output the polyfill code block corresponding to the second new feature list to the target browser when the second identification information is consistent with the identification information of the third module, wherein the third module is the next module actually accessed by the target browser.
9. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the browser code block loading method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the browser code block loading method according to any one of claims 1 to 7 are implemented.
11. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the browser code block loading method as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Page access method, device and equipment, and storage medium
CN111984892A
Browser operation method and device, computer equipment and readable storage medium
CN115878928A
Method, device and equipment for operating code block by browser and medium
CN115964031A
Dynamically bundling web page resources
US20200159817A1
Dynamic configurability of web pages
US20220129509A1