Browser code block loading method, device, equipment, medium and program product

By predicting the list of new features in the browser's next module and loading the corresponding polyfill code blocks, the problem of excessive browser code block loading is solved, achieving efficient and flexible resource management and improving page loading speed and user experience.

CN119576437BActive Publication Date: 2025-10-21CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411748863.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-10-21
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

In existing technologies, browsers load all patch code blocks at once, resulting in an excessive page loading burden that cannot match the asynchronous loading and dynamic rendering characteristics of single-page applications.

Method used

By obtaining the module identifier information currently accessed by the target browser, the next module is predicted and its corresponding list of new features is determined. Only the polyfill code block corresponding to the list of new features that are not supported by the browser is output, thereby reducing invalid loading.

Benefits of technology

It improves page loading speed, reduces page load, enhances user experience and overall performance, and conforms to the asynchronous loading and dynamic rendering characteristics of single-page applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119576437B_ABST
    Figure CN119576437B_ABST
Patent Text Reader

Abstract

The application provides a browser code block loading method and device, equipment, medium and program product, and relates to the technical field of computers. The method comprises the following steps: obtaining first identification information of a first module in a target system currently accessed by a target browser, and determining second identification information corresponding to a second module based on the first identification information, the second module being a next module accessed by the target browser based on the first module; determining a first new feature list corresponding to the second identification information according to a first correspondence relationship, and screening a second new feature list that does not support the target browser from the first new feature list corresponding to the second identification information; the first correspondence relationship is a correspondence relationship between identification information of each module in the target system and the first new feature list corresponding to each module; and when the second identification information is consistent with identification information of a next module actually accessed by the target browser, outputting polyfill code blocks corresponding to the second new feature list to the target browser.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a browser code block loading method, apparatus, device, medium, and program product. Background Art

[0002] When users access a browser, they typically use a single-page application (SPA) development model. This model eliminates the need to reload the entire browser page after the initial load. Instead, different views and functionality are displayed through asynchronous updates and dynamic replacement of page content. Related art code block loading methods, when loading World Wide Web (WEB) pages, load all polyfill code blocks at once. Polyfill resources not required for the current application page or module are also loaded ineffectively, failing to integrate the asynchronous loading and dynamic rendering features of SPAs, increasing the page loading burden. Summary of the Invention

[0003] The embodiments of the present application provide a browser code block loading method, apparatus, device, medium and program product to solve the problem of excessive page loading burden when loading web pages with code blocks 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] Obtaining first identification information of a first module in a target system currently accessed by a target browser, and determining second identification information based on the first identification information, wherein the target system is a system on which the target browser is running, the second identification information is identification information corresponding to a second module, and the second module is a next module predicted to be accessed by the target browser based on the first module;

[0007] Determining, based on the first correspondence, a first new feature list corresponding to the second identification information, 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; wherein the first correspondence is a correspondence 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 includes:

[0010] Obtain code files of each module in the target system;

[0011] Preprocessing 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 any two modules in the target system have different identification information corresponding to each other;

[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] generating a module configuration file according to 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 includes:

[0019] Based on the embedded 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 accessed successively by the target browser;

[0020] Preprocessing the interaction data to obtain second interaction data;

[0021] The pre-built 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 in the second new feature list according to the at least one first new feature includes:

[0027] Traversing each first new property in the second new property list;

[0028] If 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, where 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] filtering, according to the third identification information of the third module and the type information and version information of the target system, 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;

[0032] Generate a polyfill code block corresponding to the at least one second new feature according to the at least one second new feature in the third new feature list;

[0033] Outputting a polyfill code block corresponding to the at least one second new feature to the target browser.

[0034] In a second aspect, an embodiment of the present application further provides a browser code block loading device, comprising:

[0035] an acquisition prediction module, configured 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 is running, the second identification information is identification information corresponding to a second module, and the second module is a next module predicted to be accessed by the target browser based on the first module;

[0036] a determination and filtering module, configured to determine, based on a first correspondence, a first new feature list corresponding to the second identification information, and filter out, from the first new feature list corresponding to the second identification information, a second new feature list that is not supported by the target browser; wherein the first correspondence is a correspondence 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 above.

[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. 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] In 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 to be accessed by the target browser by the currently accessed first module is achieved. Subsequently, based on 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 is not supported by 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 following briefly introduces the drawings required for use in the description of the embodiments of the present application. 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 any creative work.

[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 by an embodiment of the present application;

[0045] Figure 3 This is a structural diagram of a browser code block loading device provided by an embodiment of the present application;

[0046] Figure 4 This is a structural 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 this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts 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 on which the target browser runs, the second identification information is identification information corresponding to a second module, and the second module is the 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 used on various terminal devices, such as mobile phones, tablet computers, laptop computers, personal digital assistants (PDAs), handheld computers, netbooks, ultra-mobile personal computers (UMPCs), mobile internet devices (MIDs), 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 appliances with wireless communication capabilities), 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. 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 during the system code construction phase of the target system, after the system code is written, the various 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 a 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 module of a target system, the target browser can directly obtain the identification information corresponding to the page or module. Subsequently, 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, the prediction of the next module to be accessed is completed when the target browser accesses the current first module, which enables more efficient and flexible resource loading and updating, without the need to load other modules, reducing page load and page waiting time.

[0053] Step 102: Determine the first new feature list corresponding to the second identification information based on 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 correspondence 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 contains multiple new features. Each new feature in the first new feature list can be screened to remove new features that are not supported by the target browser (e.g., incompatible with the target browser, not compliant with the standard, etc.). The remaining new features are then 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, unsupported new features can be identified and eliminated, the stability of the target system can be enhanced, and adjustments and optimizations can be made precisely for the target browser, allowing for the proper allocation of resources.

[0055] Step 103: When the second identification information is consistent with the identification information of the third module, the 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, causing the target browser to run each polyfill code block. In this way, the loaded polyfill code blocks are only those required for the third module currently being accessed, avoiding the extended page loading time caused by loading a large amount of irrelevant code at one time, improving the speed of first screen rendering, and also conforming to the asynchronous loading and dynamic rendering characteristics of SPA applications. This allows for more efficient and flexible processing of resource loading and updating during user navigation and interaction, reducing the page load burden, reducing resource consumption, improving page loading speed, and enhancing the overall performance and user experience of web page applications.

[0057] Optionally, the method further includes:

[0058] Obtain code files of each module in the target system;

[0059] Preprocessing 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 any two modules in the target system have different identification information corresponding to each other;

[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 based on the above-mentioned first correspondence. Among them, the first new feature list can be obtained by parsing the 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] generating a module configuration file according to 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, a sequence of modules most likely to be accessed next to each currently accessed module and their probabilities are pre-generated based on a prediction model and packaged into a module configuration file. Specifically, for each first module, when a target browser accesses the module, the trained prediction model is invoked and the Viterbi algorithm is used to calculate the sequence of modules and their probabilities that the target browser may access next to 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, and is usually set to the starting probability of the current access module.

[0070] Next, perform a recursive calculation. For each time step t>1 and each module j, calculate the sequence from the starting module to module j after t steps, and observe the maximum probability path that this sequence is consistent with the target browser's actual module access history. Since the observation value in this application is the module's identification information, the emission probability matrix is ​​integrated with the state transition probability matrix. The state transition probability matrix can be directly used to represent the probability of transitioning 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, after backtracking the optimal path and 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, ultimately obtaining the module access sequence with the highest probability.

[0074] Finally, the prediction result is obtained. The next module on the optimal path is the module most likely to be accessed by the target browser. The probability of the target browser accessing the sequence is calculated by multiplying the probabilities of each module on this path. Thus, the module configuration file is 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. This allows the prediction of the second module that the target browser will access.

[0075] Optionally, the method further includes:

[0076] Based on the embedded 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 accessed successively by the target browser;

[0077] Preprocessing the interaction data to obtain second interaction data;

[0078] The pre-built 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 a 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 regularly sent to the server 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 and other operations, 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 building 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, with one module corresponding to one state. The order in which the target browser accesses 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 calculated, 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 represents the probability that the target browser jumps from module i to module j. 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 will visit another module immediately after visiting a certain module. Here, it is integrated with the state transition probability matrix.

[0084] The above process completes the construction of the hidden Markov model. 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 for estimating 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 indicates 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, the various polyfill code blocks can be assembled into a JS file, which is then loaded into the target browser and executed. This way, only the polyfill code blocks required for the currently accessed third module are loaded, avoiding the extended page loading time caused by loading a large amount of irrelevant code at once. This reduces the page load burden, reduces resource consumption, speeds up page loading, and enhances 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 in the second new feature list according to the at least one first new feature includes:

[0093] Traversing each first new property in the second new property list;

[0094] If 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, where 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. Based on 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] filtering, according to the third identification information of the third module and the type information and version information of the target system, 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;

[0099] Generate a polyfill code block corresponding to the at least one second new feature according to the at least one second new feature in the third new feature list;

[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 correspondence 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 can be 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 embodiment 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, thereby obtaining the first correspondence;

[0106] Step 203: Input the identification information of each module in the target system into the prediction model, and obtain first output information output by the prediction model, wherein the first output information includes the identification information of the predicted access module corresponding to the target module, and 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 based on 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: If the module accessed by the target browser is the first module of the target system, obtain first identification information of the first module, type information and 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, and the type information and 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: Determine a first new feature list corresponding to the second identification information based on the first corresponding relationship, and filter 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: If 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; if 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: If 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 based on the third identification information of the third module and the type information and version information of the target system; and a corresponding polyfill code block is generated based on 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] An acquisition prediction module 301 is configured 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 the system on which the target browser is running, the second identification information is identification information corresponding to a second module, and the second module is the next module predicted to be accessed by the target browser based on the first module;

[0119] a determination and filtering module 302 configured to determine, based on a first correspondence, a first new feature list corresponding to the second identification information, and filter out, from the first new feature list corresponding to the second identification information, a second new feature list that is not supported by the target browser; wherein the first correspondence is a correspondence 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 is 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 and obtain the first new feature list corresponding to each module in the target system;

[0124] a second acquisition module, configured 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 piece of identification information, and any two modules in the target system have different corresponding identification information;

[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 based on 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 acquisition prediction module 301 includes:

[0127] a first acquiring unit, configured 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] The 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 configured to acquire, based on the embedded code pre-implanted in the target system, first interaction data between modules in the target system, the first interaction data including identification information of at least one module in the target system that is accessed successively by the target browser;

[0132] A second processing module, configured to pre-process 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 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.

[0134] Optionally, the code block output module 303 includes:

[0135] a second generating unit, configured to generate, according to at least one first new feature in the second new feature list, a polyfill code block corresponding to the at least one first new feature when the second identification information is consistent with the identification information of the third module;

[0136] A third generating unit is 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 configured to:

[0139] Traversing each first new property in the second new property list;

[0140] If 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, where 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 the 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 as Figure 1 The embodiment shown corresponds to the implementation of the device side. For specific implementation, please refer to Figure 1 In order to avoid duplication, the relevant descriptions of the embodiment shown will not be repeated in this embodiment, and the same beneficial effects can still be achieved.

[0147] See Figure 4 , Figure 4This is a structural diagram of an electronic device provided in an embodiment of the present application, wherein the electronic device includes: 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 configured to read the program or instruction in the memory 420; the electronic device also includes 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 together various circuits of one or more processors represented by processor 400 and memory represented by memory 420. The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are all well known in the art and, therefore, will not be described further herein. The bus interface provides an interface. The transceiver 410 may be a plurality of components, i.e., 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 configured to read the program or instruction in the memory 420 and further perform the following steps:

[0151] Obtaining first identification information of a first module in a target system currently accessed by a target browser, and determining second identification information based on the first identification information, wherein the target system is a system on which the target browser is running, the second identification information is identification information corresponding to a second module, and the second module is a next module predicted to be accessed by the target browser based on the first module;

[0152] Determining, based on the first correspondence, a first new feature list corresponding to the second identification information, 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; wherein the first correspondence is a correspondence 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 perform the following steps:

[0155] Obtain code files of each module in the target system;

[0156] Preprocessing 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 any two modules in the target system have different identification information corresponding to each other;

[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] generating a module configuration file according to 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 perform the following steps:

[0164] Based on the embedded 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 accessed successively by the target browser;

[0165] Preprocessing the interaction data to obtain second interaction data;

[0166] The pre-built 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] If 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, where 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] filtering, according to the third identification information of the third module and the type information and version information of the target system, 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;

[0177] Generate a polyfill code block corresponding to the at least one second new feature according to the at least one second new feature in the third new feature list;

[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 embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. 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, so they 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 to avoid repetition, they will not be described here.

[0182] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising 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 the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this 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, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or 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 this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.

Claims

1. A browser code block loading method, characterized in that: include: Obtaining first identification information of a first module in a target system currently accessed by a target browser, and determining second identification information based on the first identification information, wherein the target system is a system on which the target browser is running, the second identification information is identification information corresponding to a second module, and the second module is a next module predicted to be accessed by the target browser based on the first module; Determining, based on the first correspondence, a first new feature list corresponding to the second identification information, 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; wherein the first correspondence is a correspondence 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 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 any two modules in the target system have different identification information corresponding to each other; 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; generating a module configuration file according to 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 embedded 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 accessed successively by the target browser; Preprocessing the interaction data to obtain second interaction data; The pre-built 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, wherein 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 generating, according to the at least one first new feature in the second new feature list, a polyfill code block corresponding to the at least one first new feature includes: Traversing each first new property in the second new property list; If 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, where 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: filtering, according to the third identification information of the third module and the type information and version information of the target system, 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; Generate a polyfill code block corresponding to the at least one second new feature according to the at least one second new feature in the third new feature list; 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, configured 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 is running, the second identification information is identification information corresponding to a second module, and the second module is a next module predicted to be accessed by the target browser based on the first module; a determination and filtering module, configured to determine, based on a first correspondence, a first new feature list corresponding to the second identification information, and filter out, from the first new feature list corresponding to the second identification information, a second new feature list that is not supported by the target browser; wherein the first correspondence is a correspondence 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, which, when executed by a processor, implements the steps of the browser code block loading method according to any one of claims 1 to 7.

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 according to 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