CN113656728B - Webpage rendering method and device, electronic equipment and computer readable storage medium - Google Patents

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

Info

Publication number
CN113656728B
CN113656728B CN202110819708.XA CN202110819708A CN113656728B CN 113656728 B CN113656728 B CN 113656728B CN 202110819708 A CN202110819708 A CN 202110819708A CN 113656728 B CN113656728 B CN 113656728B
Authority
CN
China
Prior art keywords
module
script
load data
template
template script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110819708.XA
Other languages
Chinese (zh)
Other versions
CN113656728A (en
Inventor
彭靖程
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN202110819708.XA priority Critical patent/CN113656728B/en
Publication of CN113656728A publication Critical patent/CN113656728A/en
Application granted granted Critical
Publication of CN113656728B publication Critical patent/CN113656728B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

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

Abstract

The application discloses a webpage rendering method, a webpage rendering device, electronic equipment and a computer readable storage medium, wherein the webpage rendering method comprises the following steps: acquiring a template script corresponding to a webpage, and sending an identifier corresponding to the template script to a forwarding server; acquiring a configuration file corresponding to the identifier from a back-end server by a forwarding server, generating a load data tag based on the configuration file, and splicing the load data tag with the template script; executing the template script, and acquiring a plurality of module scripts corresponding to the template script from the forwarding server; based on the load data label in the template script, acquiring a load data entity corresponding to the load data label and writing the load data entity into the corresponding module script; all module scripts including the payload data entity are executed to cause the web page to complete rendering. By the aid of the scheme, webpage rendering efficiency can be improved, and webpage rendering time is shortened.

Description

Webpage rendering method and device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and apparatus for rendering a web page, an electronic device, and a computer readable storage medium.
Background
With the advent of the information age, the approach of obtaining information by users gradually inclines towards web pages, and simultaneously, higher requirements are also put forward by users on the speed of web page rendering. In the prior art, the template script corresponding to the webpage is usually integrated with multiple functional complete codes, so that the size of the template script is larger, and further the network bandwidth requirement required by executing the template script corresponding to the webpage is high when the webpage is rendered, and the webpage rendering time is long. In view of this, how to improve the efficiency of webpage rendering and reduce the webpage rendering time is a urgent problem to be solved.
Disclosure of Invention
The technical problem that this application mainly solves is to provide a webpage rendering method, device, electronic equipment and computer readable storage medium, can improve webpage rendering's efficiency, reduces webpage rendering time.
In order to solve the above technical problems, a first aspect of the present application provides a webpage rendering method, where the webpage rendering method includes: acquiring a template script corresponding to a webpage, and sending an identifier corresponding to the template script to a forwarding server; acquiring a configuration file corresponding to the identifier from a back-end server by the forwarding server, generating a load data tag based on the configuration file, and splicing the load data tag with the template script; executing the template script, and acquiring a plurality of module scripts corresponding to the template script from the forwarding server; based on the load data label in the template script, acquiring a load data entity corresponding to the load data label and writing the load data entity into the corresponding module script; executing all the module scripts comprising the payload data entity so that the webpage is rendered.
To solve the above technical problem, a second aspect of the present application provides a web page rendering device, including: the system comprises a forwarding module, a splicing module, a processing module, a writing module and a rendering module. The forwarding module is used for acquiring a template script corresponding to the webpage and sending an identifier corresponding to the template script to the forwarding server; the splicing module is used for acquiring a configuration file corresponding to the identifier from a back-end server by the forwarding server, generating a load data tag based on the configuration file and splicing the load data tag with the template script; the processing module is used for executing the template script and acquiring a plurality of module scripts corresponding to the template script from the forwarding server; the writing module is used for acquiring a load data entity corresponding to the load data label based on the load data label in the template script and writing the load data entity into the corresponding module script; and the rendering module is used for executing all the module scripts comprising the payload data entity so as to enable the webpage to complete rendering.
In order to solve the above technical problem, a third aspect of the present application provides an electronic device, which includes a memory and a processor that are coupled to each other, wherein the memory stores program instructions, and the processor invokes the program instructions to implement the webpage rendering method of the first aspect.
To solve the above technical problem, a fourth aspect of the present application provides a computer-readable storage medium having program instructions stored thereon, which when executed by a processor, implement the web page rendering method of the first aspect.
The beneficial effects of this application are: after the template script corresponding to the webpage is obtained, the identification of the template script is sent to the forwarding server, so that the forwarding server obtains a configuration file corresponding to the identification, a load data label is generated based on the configuration file, the load data label is spliced with the template script, the template script is enabled to know which load data entities exist, the template script is further executed to obtain a plurality of module scripts corresponding to the template script from the forwarding server, the template script is split into a plurality of module scripts, the corresponding load data entities are obtained based on the load data label and are written into the module scripts, and data with larger code volumes such as the load data entities are executed by the plurality of module scripts, so that webpage rendering efficiency is improved, and webpage rendering time is shortened.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. Wherein:
FIG. 1 is a flow chart of an embodiment of a method for rendering web pages according to the present application;
FIG. 2 is a flow chart of another embodiment of a web page rendering method of the present application;
FIG. 3 is a schematic diagram illustrating a frame of an embodiment of a web page rendering apparatus according to the present application;
FIG. 4 is a schematic diagram of a framework of an embodiment of the electronic device of the present application;
FIG. 5 is a schematic diagram of a framework of one embodiment of a computer readable storage medium of the present application.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The terms "system" and "network" are often used interchangeably herein. The term "and/or" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship. Further, "a plurality" herein means two or more than two.
Referring to fig. 1, fig. 1 is a flowchart illustrating an embodiment of a web page rendering method of the present application.
Specifically, the method may include the steps of:
s101: the template script corresponding to the webpage is obtained, and the identification corresponding to the template script is sent to the forwarding server.
Specifically, after a user opens a webpage, a template script corresponding to the webpage and an identifier corresponding to the template script are obtained, and the identifier corresponding to the template script is sent to a forwarding server, so that the forwarding server receives the identifier corresponding to the template script, wherein the forwarding server is used for responding to a request of a webpage end and sending data to the webpage end.
In an application mode, each webpage is generated based on one template script, parameters at the tail of a path address of the webpage are used as identifiers corresponding to the template scripts when the webpage is generated, after a user opens the webpage, the path address of the webpage is obtained, the template scripts corresponding to the webpage and the identifiers corresponding to the template scripts are obtained based on the parameters at the tail of the path address of the webpage, and the identifiers corresponding to the template scripts are sent to a forwarding server.
S102: and acquiring a configuration file corresponding to the identifier from the back-end server by the forwarding server, generating a load data tag based on the configuration file, and splicing the load data tag with the template script.
Specifically, a configuration file corresponding to the template script is stored on a back-end server, the configuration file corresponding to the identification of the template script is obtained from the back-end server through a forwarding server, so that the configuration file corresponding to the template script is obtained, and a load data label is generated based on load data entities for realizing different functions in the configuration file, wherein the load data label comprises information such as names and/or positions and/or indexes of the load data entities, so that after the load data label is spliced in the template script, the template script can know which load data entities exist in the execution process. The code corresponding to each payload data entity is used for realizing one type of function, and after the code corresponding to the payload data entity is executed, different types of data such as images, texts, audios and the like can be provided for the webpage, and modules with different functions such as popup windows, floating windows and the like can also be provided for the webpage.
In an application mode, the template script comprises a plurality of types of module scripts, each module script is compiled and stored on a forwarding server in advance, when the corresponding module script is configured, the forwarding server sends the corresponding module script to a back-end server, an operation and maintenance person generates and stores a configuration file corresponding to the module script on the back-end server, wherein the configuration file corresponds to a module main function, the module main function comprises at least one sub-function for realizing one type of function, a plurality of lines of codes needing to be executed row by row are corresponding to the sub-function, and each sub-function is a load data entity.
In an application scene, a forwarding server is used for acquiring a template script corresponding to the identifier, a configuration file corresponding to each module script is acquired from a back-end server based on the module script included in the template script, a load data entity in the configuration file is extracted, a load data label is generated based on the position of the load data entity in the configuration file, namely, the load data label is generated based on the position of a sub-function in a module main function, and the load data label is spliced to the tail end of the template script.
In another application scenario, a forwarding server is used for acquiring a template script corresponding to the identifier, a configuration file corresponding to each module script is acquired from a back-end server based on the module script included in the template script, a load data entity in the configuration file is extracted by the forwarding server, a load data label is generated based on an index of the load data entity in the configuration file, namely, the load data label is generated based on an index value of a sub-function relative to a main function of a module, and the load data label is spliced to the tail end of the template script.
S103: and executing the template script, and acquiring a plurality of module scripts corresponding to the template script from the forwarding server.
Specifically, in response to a request of a user to open a webpage, the template script is interpreted and executed, all module scripts corresponding to the template script are obtained, wherein one module script corresponds to different types of functions on the webpage when the webpage is generated, the module scripts are stored in a forwarding server in advance, and the template script is executed, so that a plurality of module scripts corresponding to the template script are obtained from the forwarding server.
S104: based on the load data label in the template script, acquiring a load data entity corresponding to the load data label and writing the load data entity into the corresponding module script.
Specifically, according to the spliced load data labels in the template script, acquiring load data entities corresponding to the load data labels, and writing the load data entities into the corresponding module script.
In an application mode, a payload data entity corresponding to the payload data tag is obtained, and codes corresponding to the payload data entity are copied and written into corresponding module scripts.
In an application scene, the load data tag is the position of the load data entity in the configuration file, the configuration file corresponds to the module script, the sub-function of the corresponding position is extracted from the module main function corresponding to the configuration file based on the load data tag, and the name of the sub-function and codes in the sub-function are written into the module script corresponding to the configuration file.
In another application scenario, the load data tag is an index corresponding to the load data entity, the configuration file corresponds to the module script, the corresponding sub-function is found from the module main function corresponding to the configuration file based on the load data tag, and the name of the sub-function and the code in the sub-function are written into the module script corresponding to the configuration file.
S105: all module scripts including the payload data entity are executed to cause the web page to complete rendering.
Specifically, all the module scripts are executed, and when the module scripts are executed, the payload data entities included in the scripts are also executed together, so that the webpage is rendered. The module scripts can be executed in parallel, and the code volume of a single module script is smaller due to the fact that the module scripts are split, so that webpage rendering can be completed faster and smoother when the module scripts are executed.
In an application mode, codes in each module script are executed row by row, and each module script is executed in parallel, so that the execution efficiency among different types of module scripts is improved, and the webpage rendering speed is improved.
According to the scheme, the forwarding server is set up, after the template script corresponding to the webpage is obtained, the identification of the template script is sent to the forwarding server, so that the forwarding server obtains the configuration file corresponding to the identification, the load data label is generated based on the configuration file, the load data label is spliced with the template script, the template script is enabled to know which load data entity exists, the template script is further executed to obtain a plurality of module scripts corresponding to the template script from the forwarding server, the template script is split into the plurality of module scripts, the corresponding load data entity is obtained based on the load data label, and the data with larger code volume such as the load data entity is executed by the plurality of module scripts, so that webpage rendering efficiency is improved, and webpage rendering time is shortened.
Referring to fig. 2, fig. 2 is a flowchart illustrating another embodiment of a web page rendering method according to the present application.
Specifically, the method may include the steps of:
s201: the template script corresponding to the webpage is obtained, and the identification corresponding to the template script is sent to the forwarding server.
Specifically, a template script corresponding to a webpage and an identifier corresponding to the template script are obtained, and the identifier is sent to a forwarding server from a webpage end.
In an application mode, each webpage is generated based on a template script, a unique identifier is inserted into the template script when the webpage is generated, the template script corresponding to the webpage is obtained after a user opens the webpage, the identifier in the template script is extracted, and the identifier corresponding to the template script is sent to a forwarding server.
S202: and acquiring the template script corresponding to the identification by the forwarding server, and acquiring the configuration file corresponding to the module script from the back-end server based on all the module scripts included in the template script.
Specifically, the template script includes multiple types of module scripts, each module script is stored on the forwarding server after compiling, and each module script corresponds to a configuration file, and the configuration file is stored on the back-end server.
Further, the module script comprises an empty load data slot for placing a load data entity, and when the module script is compiled, fake load data is added into the load data slot, wherein the code volume of the fake load data is smaller than that of the load data entity, the fake load data is used for occupying the load data slot first, then logic of the module script is written, and the fake load data and the logic of the module script are compressed, compiled and packaged to generate the module script and stored on the forwarding server. In the webpage generation stage, in order to realize what is configured in the background and what is displayed at the front end of the webpage, namely, in order to realize the function obtained by the view, after any type of function module is introduced, a module script corresponding to the function module is acquired from a forwarding server, the forwarding server sends the corresponding module script to the background server, an operation and maintenance person sets a configuration file on the background server, wherein the configuration file comprises a load data entity for filling a load data slot later, and the capability obtained by the view can be realized after the configuration file is set.
In an application mode, a forwarding server can quickly determine a corresponding template script according to the identification, and according to all module scripts included in the template script, a configuration file corresponding to the module script is obtained from a back-end server by the forwarding server, wherein a plurality of lines of codes are included in a payload data entity in the configuration file and are subsequently used for filling a payload data slot, the configuration file is stored on the back-end server for calling, the code volumes of the template script and the module script are reduced, and the execution efficiency of the template script and the module script is improved.
S203: traversing configuration files corresponding to all module scripts to obtain load data entities in all configuration files, and converting the load data entities into load data labels.
Specifically, configuration files corresponding to all module scripts included in the template script are respectively extracted, a payload data entity is obtained from the configuration files, and the payload data entity is converted into a payload data tag, wherein the code volume of the payload data tag is far smaller than that of the payload data entity, and then the execution efficiency of the template script is improved when the template script is executed subsequently.
In an application mode, sequentially searching the payload data entities in the configuration file corresponding to the module script on the back-end server, generating indexes of the payload data entities, and taking the indexes of the payload data entities as payload data labels.
S204: and splicing the addresses of the load data labels and all the module scripts on the forwarding server to the tail of the template script.
Specifically, the load data labels and the addresses of all the module scripts on the forwarding server are spliced to the tail end of the template script, so that the template script can acquire the corresponding load data entity based on the load data labels, and acquire the module script based on the addresses of the module scripts on the forwarding server, and the data quantity of the load data labels and the addresses of the module scripts on the forwarding server, which are integrated in the template script, is far smaller than the load data entity, so that the efficiency of executing the template script can be greatly improved when the template script is executed.
In an application mode, splicing the address of the module script on the forwarding server to the tail of the template script and serializing the template script; and (5) splicing the encrypted load data tag to the tail of the serialized template script.
Specifically, the address of the module script on the forwarding server is spliced to the tail end of the template script, the template script is serialized, so that the template script is convenient to transmit, the load data label is spliced to the tail end of the serialized template script after being encrypted, and therefore the safety of the load data entity corresponding to the load data label is improved.
In an application scenario, the payload data tag is encrypted using a secure hash algorithm (Secure Hash Algorithm, SHA-1) and spliced to the end of the serialized template script, where SHA-1 is a cryptographic hash function that generates a 160-bit hash value called a message digest, typically in the form of 40 hexadecimal numbers. Other encryption algorithms may be used in other application scenarios, which are not particularly limited in this application.
S205: and executing the template script, and acquiring a plurality of module scripts corresponding to the template script from the forwarding server.
Specifically, executing a template script corresponding to the webpage to obtain basic logic corresponding to the webpage and bottom layer image rendering; and acquiring all the module scripts corresponding to the template script from the forwarding server based on the addresses of all the module scripts on the forwarding server.
The method comprises the steps of responding to a request of a user for opening a webpage, interpreting and executing a template script, thereby obtaining basic logic of the webpage, waiting for rendering of a bottom image to be completed, extracting an address of a module script contained at the tail of the template script on a forwarding server when the execution reaches the tail of the template script, extracting the module script at a corresponding position based on the address of the module script on the forwarding server, and completing execution of the template script, so as to quickly respond to the request of the user for opening the webpage, complete basic logic execution of the webpage and rendering of the bottom image, and find the module script corresponding to the template script.
S206: and extracting a load data label from the tail of the template script, and acquiring a corresponding load data entity based on the load data label.
Specifically, extracting a label of the payload data from the end of the template script, and matching the corresponding payload data entity according to the label of the payload data.
In an application mode, the load data tag is an index of a load data entity, and a plurality of lines of codes corresponding to the corresponding load data entity are obtained from a configuration file on a back-end server according to the index of the load data entity.
S207: and writing the payload data entity into the head of the corresponding module script.
Specifically, the payload data entity corresponds to the payload data tag, and the corresponding module script can be obtained through the payload data tag, so that the payload data entity is written into the header of the corresponding module script, so as to be used for preferentially executing and obtaining the payload data entity.
In an application mode, the payload data slot is arranged at the head of the template script, and the forged payload data is replaced by a plurality of lines of codes corresponding to the payload data entity, so that the payload data entity is written into the head of the corresponding module script.
S208: all module scripts including the payload data entity are executed to cause the web page to complete rendering.
Specifically, all module scripts including the payload data entity are executed, and on the basis of the underlying logic and the underlying image rendering, the web page is rendered based on the payload data entity. All module scripts including the payload data entity may be executed sequentially or in parallel.
In an application mode, a plurality of lines of codes corresponding to the payload data entity are stored in the payload data slot, and the codes in the payload data slot of the module script are executed line by line on the basis logic and the bottom layer image rendering of the webpage so as to render the webpage, so that the function corresponding to the payload data entity is displayed on the webpage, wherein at least part of the module scripts are executed in parallel, and further, other module scripts are executed in parallel in sequence until all the module scripts are executed.
In this embodiment, a forwarding server is set up, a configuration file of all module scripts included in a template script is obtained through the forwarding server, a load data tag is generated based on the configuration file, the addresses of the load data tag and the module scripts on the forwarding server are spliced to the tail end of the template script, so that the code volume of the template script is reduced, the template script is further executed to improve the execution efficiency of the template script, the module scripts are obtained through the addresses of the module scripts on the forwarding server, a load data entity is obtained through the load data tag, the load data entity is written into the corresponding module scripts, all the module scripts are executed to complete webpage rendering, and the template script is divided into a plurality of module scripts to be executed to improve the webpage rendering efficiency.
Referring to fig. 3, fig. 3 is a schematic frame diagram of an embodiment of a web page rendering device of the present application. The web page rendering device 30 includes a forwarding module 300, a stitching module 302, a processing module 304, a writing module 306, and a rendering module 308. The forwarding module 300 is configured to obtain a template script corresponding to a web page, and send an identifier corresponding to the template script to the forwarding server; the splicing module 302 is configured to obtain, by means of the forwarding server, a configuration file corresponding to the identifier from the backend server, generate a load data tag based on the configuration file, and splice the load data tag with the template script; the processing module 304 is configured to execute a template script, and obtain a plurality of module scripts corresponding to the template script from the forwarding server; the writing module 306 is configured to obtain a payload data entity corresponding to the payload data tag based on the payload data tag in the template script, and write the payload data entity into the corresponding module script; the rendering module 308 is configured to execute all module scripts including payload data entities to cause the web page to complete rendering.
In the above solution, a forwarding server is set up, after the forwarding module 300 obtains a template script corresponding to a web page, the forwarding module sends an identifier of the template script to the forwarding server, so that the forwarding server obtains a configuration file corresponding to the identifier, the splicing module 302 generates a payload data tag based on the configuration file, and splices the payload data tag with the template script, so that the template script knows which payload data entities are in the template script, and the processing module 304 executes the template script to obtain a plurality of module scripts corresponding to the template script from the forwarding server, so that the template script is split into a plurality of module scripts, the writing module 306 obtains the corresponding payload data entities based on the payload data tag, writes the corresponding payload data entities into the module scripts, and the rendering module scripts including the payload data entities are executed by the rendering module 308, so that data with larger code volumes such as the payload data entities are executed by the plurality of module scripts, thereby improving the efficiency of web page rendering and reducing the web page rendering time.
In some embodiments, the template script includes multiple types of module scripts, each module script is stored on the forwarding server after compiling, and each module script corresponds to a configuration file, which is stored on the back-end server. The stitching module 302 may also be used to: and acquiring the template script corresponding to the identification by the forwarding server, and acquiring the configuration file corresponding to the module script from the back-end server based on all the module scripts included in the template script.
In some embodiments, the stitching module 302 may also be configured to: traversing configuration files corresponding to all module scripts to obtain load data entities in all configuration files, and converting the load data entities into load data labels; and splicing the addresses of the load data labels and all the module scripts on the forwarding server to the tail of the template script.
In some embodiments, the stitching module 302 may also be configured to: splicing the address of the module script on the forwarding server to the tail of the template script and serializing the template script; and (5) splicing the encrypted load data tag to the tail of the serialized template script.
In some embodiments, the write module 306 may also be configured to: extracting a load data tag from the tail of the template script, and acquiring a corresponding load data entity based on the load data tag; and writing the payload data entity into the head of the corresponding module script.
In some embodiments, the processing module 304 may also be configured to: executing a template script corresponding to the webpage to obtain basic logic corresponding to the webpage and rendering the bottom layer image; and acquiring all the module scripts corresponding to the template script from the forwarding server based on the addresses of all the module scripts on the forwarding server.
In some embodiments, rendering module 308 may also be configured to: and executing all the module scripts comprising the payload data entity, and rendering the webpage based on configuration files corresponding to the payload data entity and the module scripts on the basis of the base logic and the rendering of the bottom layer image.
Referring to fig. 4, fig. 4 is a schematic frame diagram of an embodiment of the electronic device of the present application. The electronic device 40 comprises a memory 401 and a processor 402 coupled to each other, the memory 401 storing program instructions, the processor 402 invoking the program instructions to implement the steps of any of the webpage rendering method embodiments described above.
In particular, the processor 402 is configured to control itself and the memory 401 to implement the steps of any of the webpage rendering method embodiments described above. The processor 402 may also be referred to as a CPU (Central Processing Unit ). The processor 402 may be an integrated circuit chip with signal processing capabilities. The processor 402 may also be a general purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a Field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 402 may be commonly implemented by an integrated circuit chip.
According to the scheme, the processor 402 can reduce the code volume of the template script corresponding to the webpage by setting up the forwarding server, so that the webpage rendering efficiency is improved, and the webpage rendering time is reduced.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating an embodiment of a computer readable storage medium according to the present application. The computer readable storage medium 50 stores program instructions 500 that can be executed by a processor, the program instructions 500 when executed by the processor implementing the steps of any of the webpage rendering method embodiments described above.
In the several embodiments provided in the present application, it should be understood that the disclosed methods and apparatuses may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical, or other forms.
The elements illustrated as separate elements may or may not be physically separate, and elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over network elements. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all or part of the technical solution contributing to the prior art or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.

Claims (10)

1. A web page rendering method, comprising:
acquiring a template script corresponding to a webpage, and sending an identifier corresponding to the template script to a forwarding server;
acquiring a configuration file corresponding to the identifier from a back-end server by the forwarding server, generating a load data tag based on the configuration file, and splicing the load data tag with the template script; the template scripts comprise a plurality of types of module scripts, each module script is stored on the forwarding server after being compiled, each module script corresponds to the configuration file, and the configuration files are stored on the back-end server; the load data tag is related to a load data entity in the configuration file, and the load data tag is spliced at the tail end of the template script;
executing the template script, and acquiring a plurality of module scripts corresponding to the template script from the forwarding server;
based on the load data label in the template script, acquiring a load data entity corresponding to the load data label and writing the load data entity into the corresponding module script;
executing all the module scripts comprising the payload data entity so that the webpage is rendered.
2. The web page rendering method according to claim 1, wherein the step of acquiring, by the forwarding server, the configuration file corresponding to the identification from a backend server includes:
and acquiring the template script corresponding to the identifier by the forwarding server, and acquiring the configuration file corresponding to the module script from the back-end server based on all the module scripts included in the template script.
3. The web page rendering method of claim 2, wherein the generating a payload data tag based on the configuration file and concatenating the payload data tag with the template script comprises:
traversing the configuration files corresponding to all the module scripts to obtain the load data entities in all the configuration files, and converting the load data entities into the load data labels;
and splicing the addresses of the load data labels and all the module scripts on the forwarding server to the tail of the template script.
4. A web page rendering method as claimed in claim 3, wherein the step of concatenating the addresses of the payload data tag and all the module scripts on the forwarding server to the end of the template scripts comprises:
splicing the address of the module script on the forwarding server to the tail of the template script and serializing the template script;
and encrypting the load data tag and then splicing the encrypted load data tag to the tail of the serialized template script.
5. The method according to claim 4, wherein the step of acquiring a payload data entity corresponding to the payload data tag based on the payload data tag in the template script and writing the payload data entity into the corresponding module script includes:
extracting the load data label from the tail of the template script, and acquiring the corresponding load data entity based on the load data label;
and writing the payload data entity into the head of the corresponding module script.
6. A web page rendering method according to claim 3, wherein the step of executing the template script and acquiring a plurality of module scripts corresponding to the template script from the forwarding server comprises:
executing the template script corresponding to the webpage to obtain basic logic and bottom image rendering corresponding to the webpage;
and acquiring all the module scripts corresponding to the template script from the forwarding server based on the addresses of all the module scripts on the forwarding server.
7. The web page rendering method of claim 6, wherein the step of executing all the module scripts including the payload data entity to cause the web page to complete rendering comprises:
executing all the module scripts comprising the payload data entity, and rendering the webpage based on configuration files corresponding to the payload data entity and the module scripts on the basis of the basic logic and the rendering of the bottom layer image.
8. A web page rendering apparatus, comprising:
the forwarding module is used for acquiring a template script corresponding to the webpage and sending an identifier corresponding to the template script to the forwarding server;
the splicing module is used for acquiring a configuration file corresponding to the identifier from a back-end server by the forwarding server, generating a load data tag based on the configuration file and splicing the load data tag with the template script; the template scripts comprise a plurality of types of module scripts, each module script is stored on the forwarding server after being compiled, each module script corresponds to the configuration file, and the configuration files are stored on the back-end server; the load data tag is related to a load data entity in the configuration file, and the load data tag is spliced at the tail end of the template script;
the processing module is used for executing the template script and acquiring a plurality of module scripts corresponding to the template script from the forwarding server;
the writing module is used for acquiring a load data entity corresponding to the load data label based on the load data label in the template script and writing the load data entity into the corresponding module script;
and the rendering module is used for executing all the module scripts comprising the payload data entity so as to enable the webpage to complete rendering.
9. An electronic device, comprising: a memory and a processor coupled to each other, wherein the memory stores program instructions that are invoked by the processor to perform the method of any of claims 1-7.
10. A computer readable storage medium having stored thereon program instructions, which when executed by a processor, implement the method of any of claims 1-7.
CN202110819708.XA 2021-07-20 2021-07-20 Webpage rendering method and device, electronic equipment and computer readable storage medium Active CN113656728B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110819708.XA CN113656728B (en) 2021-07-20 2021-07-20 Webpage rendering method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110819708.XA CN113656728B (en) 2021-07-20 2021-07-20 Webpage rendering method and device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113656728A CN113656728A (en) 2021-11-16
CN113656728B true CN113656728B (en) 2024-01-19

Family

ID=78477524

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110819708.XA Active CN113656728B (en) 2021-07-20 2021-07-20 Webpage rendering method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113656728B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080184199A1 (en) * 2007-01-25 2008-07-31 Eric Philip Fried Method and apparatus for resolving client-side logic
CN110990731A (en) * 2019-10-12 2020-04-10 平安国际智慧城市科技股份有限公司 Rendering method, device and equipment of static webpage and computer storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080184199A1 (en) * 2007-01-25 2008-07-31 Eric Philip Fried Method and apparatus for resolving client-side logic
CN110990731A (en) * 2019-10-12 2020-04-10 平安国际智慧城市科技股份有限公司 Rendering method, device and equipment of static webpage and computer storage medium

Also Published As

Publication number Publication date
CN113656728A (en) 2021-11-16

Similar Documents

Publication Publication Date Title
US9251201B2 (en) Compatibly extending offload token size
WO2018145635A1 (en) File generation method, device, server, and storage medium
US20140033262A1 (en) Parsing Single Source Content for Multi-Channel Publishing
CN111177113B (en) Data migration method, device, computer equipment and storage medium
CN111400246B (en) Asynchronous file import method, device, computer equipment and storage medium
WO2016202000A1 (en) Differential rollback upgrading method and apparatus
CN111881209A (en) Data synchronization method and device for heterogeneous database, electronic equipment and medium
CN109284453A (en) Data download method and device based on PDF document, storage medium, terminal
CN110708363A (en) File transmission method, system, electronic equipment and storage medium
CN113656728B (en) Webpage rendering method and device, electronic equipment and computer readable storage medium
WO2023143545A1 (en) Resource processing method and apparatus, electronic device, and computer-readable storage medium
US8161023B2 (en) Inserting a PDF shared resource back into a PDF statement
CN111767498B (en) Method and device for realizing file information sharing
EP3507689B1 (en) Java card application package used as a library package
CN111324645B (en) Block chain data processing method and device
CN108985109B (en) Data storage method and device
US20100115141A1 (en) Processor and method for controlling memory
CN112417828A (en) Method for adding watermark label for domestic operating system
CN112672180B (en) Live interface element configuration method, device and storage medium
CN110262856A (en) A kind of application data acquisition method, device, terminal and storage medium
CN104424238B (en) A kind of method, apparatus that mass file generates
CN112307010B (en) Data storage method, device and equipment
CN113313540B (en) Contract generation method and device, electronic equipment and readable storage medium
CN112307011B (en) Data storage method, device and equipment
CN115033410A (en) Abnormal link tracking method, system, gateway and storage medium

Legal Events

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