Page rendering method and device, electronic equipment and medium

By identifying the target resources related to the access request and generating a second template file that does not contain redundant resources, the problem of slow page loading speed in server-side rendering mode is solved, and on-demand loading of resources and improved page loading speed are achieved.

CN121636833APending Publication Date: 2026-03-10BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In server-side rendering mode, slow page loading speed is due to the loading of redundant resources, a problem that existing technologies have not been able to effectively solve.

Method used

By responding to user access requests, the target resources related to the access requests in the first template file are determined, a second template file without redundant resources is generated, and the page is rendered based on the second template file.

Benefits of technology

It enables on-demand resource loading, improves page loading speed, reduces storage space usage, and enhances rendering reliability and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121636833A_ABST
    Figure CN121636833A_ABST
Patent Text Reader

Abstract

The invention relates to a page rendering method and device, electronic equipment and a medium. The page rendering method comprises the following steps: in response to an access request of a user to a page, determining a target resource related to the access request in a first template file; generating a second template file according to the target resource; and rendering the page according to the second template file. According to the page rendering method and device, page rendering is carried out through the target resources in the first template file, loading of redundant resources in the first template file is avoided, so that on-demand loading of the resources is achieved, and the page loading speed is increased.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of Internet, and particularly relates to a page rendering method and device, electronic equipment and medium. BACKGROUND

[0002] In order to improve the speed of page rendering, a server-side rendering (SSR) mode is used in the development process, and all resources are packaged to generate a template file for page return. However, since only part of the resources in the template file are related to the access request of the user, redundant resources in the template file are loaded during page rendering, which affects the speed of page loading. SUMMARY

[0003] In order to overcome the problems in the related art, the present disclosure provides a page rendering method, device, electronic equipment and medium.

[0004] According to a first aspect of an embodiment of the present disclosure, a page rendering method is provided, and the page rendering method comprises:

[0005] In response to an access request of a user to a page, determining a target resource in a first template file related to the access request;

[0006] According to the target resource, generating a second template file;

[0007] According to the second template file, rendering the page.

[0008] In some embodiments of the present disclosure, the access request comprises a page path; and the determining the target resource in the first template file related to the access request comprises:

[0009] According to the page path, determining identification information;

[0010] According to the identification information, determining the corresponding target resource in the first template file.

[0011] In some embodiments of the present disclosure, before the determining the identification information according to the page path, the determining the target resource in the first template file related to the access request further comprises:

[0012] Injecting the page path into a label attribute of the first template file;

[0013] The determining the identification information according to the page path comprises:

[0014] Filtering the label attribute to obtain the identification information.

[0015] In some embodiments of the present disclosure, before the injecting the page path into the label attribute of the first template file, the determining the target resource in the first template file related to the access request further includes:

[0016] intercepting the page path;

[0017] after the injecting the page path into the label attribute of the first template file, the determining the target resource in the first template file related to the access request further includes:

[0018] intercepting the first template file.

[0019] In some embodiments of the present disclosure, the generating the second template file according to the target resource includes:

[0020] filtering resources in the first template file except the target resource to obtain the second template file; or,

[0021] generating the second template file with the target resource.

[0022] In some embodiments of the present disclosure, the generating the second template file according to the target resource includes:

[0023] obtaining target information, the target information being used to accelerate the rendering speed of the page;

[0024] generating the second template file according to the target information and the target resource.

[0025] In some embodiments of the present disclosure, before the rendering the page according to the second template file, the page rendering method further includes:

[0026] performing security protection processing on the access request and / or the second template file.

[0027] According to a second aspect of the embodiments of the present disclosure, a page rendering apparatus is provided, and the page rendering apparatus includes:

[0028] a determining module configured to determine a target resource in a first template file related to an access request of a user to a page in response to the access request;

[0029] a generating module configured to generate a second template file according to the target resource;

[0030] a rendering module configured to render a page according to the second template file.

[0031] According to a third aspect of the present disclosure, an electronic device is provided, the electronic device comprising:

[0032] processor;

[0033] Memory used to store the processor's executable instructions;

[0034] The processor is configured to execute the page rendering method described above.

[0035] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, wherein when instructions in the storage medium are executed by a processor of a terminal, the terminal is enabled to perform the page rendering method as described above.

[0036] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0037] In response to a user's request to access a page, the system identifies the target resources related to the request in the first template file, determining the resources the user needs from all resources in the first template file. Based on the target resources, a second template file is generated, ensuring that it does not contain redundant resources from the first template file. The page is then rendered based on the second template file, allowing the user to access the page. By rendering the page using the target resources from the first template file, redundant resources in the first template file are avoided, enabling on-demand resource loading and thus improving page loading speed.

[0038] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0039] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0040] Figure 1 This is a flowchart illustrating a page rendering method according to an exemplary embodiment;

[0041] Figure 2 This is a flowchart illustrating a page rendering method according to another exemplary embodiment;

[0042] Figure 3 This is a flowchart illustrating a page rendering method according to another exemplary embodiment;

[0043] Figure 4 This is a flowchart illustrating a page rendering method according to another exemplary embodiment;

[0044] Figure 5This is a block diagram of a page rendering apparatus according to an exemplary embodiment;

[0045] Figure 6 This is a block diagram of an electronic device according to an exemplary embodiment.

[0046] In the picture:

[0047] 100 - Determine module; 200 - Generate module; 300 - Render module; 400 - Electronic device; 402 - Processing component; 404 - Memory; 406 - Power supply component; 408 - Multimedia component; 410 - Audio component; 412 - Input / output interface; 414 - Sensor component; 416 - Communication component; 420 - Processor. Detailed Implementation

[0048] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims. It should also be understood that the term “and / or” as used in this disclosure refers to and includes any or all possible combinations of one or more of the associated listed items.

[0049] Page rendering modes include client-side rendering (CSR) and server-side rendering. To improve rendering speed, server-side rendering is used during development, where all resources are packaged into a template file for the page to be returned. However, in different regions, for the same user request, only a portion of resources may be loaded, requiring filtering of other resources. Alternatively, for different user requests, only different portions of resources may need to be loaded, without loading the rest. Because all resources in the template file need to be loaded during page rendering, page loading speed is slow.

[0050] To address the aforementioned technical issues, this disclosure provides a page rendering method that renders by loading target resources related to the access request from a first template file, thereby avoiding rendering with redundant resources and improving page loading speed.

[0051] This disclosure provides a page rendering method, such as... Figure 1 As shown, the method includes:

[0052] S100. In response to a user's request to access a page, determine the target resource in the first template file that is related to the access request.

[0053] S200. Generate a second template file based on the target resource.

[0054] S300. Render the page according to the second template file.

[0055] In this embodiment, in response to a user's request to access a page, the target resource related to the access request in the first template file is determined, so as to identify the resource required by the user from all resources in the first template file. Based on the target resource, a second template file is generated, ensuring that the second template file does not contain redundant resources from the first template file. Based on the second template file, the page is rendered, allowing the user to access the page. By rendering the page using the target resource from the first template file, redundant resources in the first template file are avoided, enabling on-demand loading of resources and thus improving page loading speed.

[0056] For example, the first template file and the second template file can be HyperText Markup Language (HTML) template files. The first template file can be a template file developed using a front-end framework according to business requirements. For example, the front-end framework could be Nuxt.js. The first template file is stored on the server after development is complete. Target resources include static resources, which can be text resources, image resources, video resources, etc. Target resources can include static resources that the current page needs to load, as well as pre-loaded static resources.

[0057] In one embodiment, such as Figure 2 As shown, the access request includes a page path. The target resource related to the access request in the first template file is determined in step S100 as follows:

[0058] S110. Determine the identification information based on the page path.

[0059] S120. Based on the identification information, determine the target resource corresponding to the first template file.

[0060] In this embodiment, identification information is determined based on the page path to identify the page path type. Based on the identification information, the corresponding target resource in the first template file is determined, thus identifying the resource to be loaded based on the page path type. Determining the target resource based on the identification information facilitates locating the required resource in the first template file, thereby improving page loading speed.

[0061] For example, the identification information can be represented in the form of characters. For the same access request from users in different regions, different letters in the characters can be used to distinguish them, thus loading the target resources allowed in that region. For example, for region one, 'A' can be used as the letter in the identification information. For region two, 'B' can be used as the letter in the identification information. For different access requests from users in the same region, different numbers in the characters can be used to distinguish them, thus loading the required target resources. For example, for access request 1, '1' can be used as the number in the identification information. For access request 2, '2' can be used as the number in the identification information.

[0062] It is understandable that, in addition to determining the identification information based on the page path, the identification information can also be determined based on information in the access request such as the query string and fragment identifier; this is not limited here.

[0063] In one embodiment, before determining the identification information based on the page path in step S110, determining the target resource related to the access request in the first template file in step S100 further includes:

[0064] Inject the page path into the tag attribute of the first template file.

[0065] In step S110, the identification information based on the page path is determined in the following way:

[0066] Filter the tag attributes to obtain the identification information.

[0067] In this embodiment, since the information in the tag attributes of the first template file is used to characterize whether related resources need to be loaded during page rendering, the page path is injected into the tag attributes of the first template file to load resources related to the access request. The tag attributes are filtered to obtain identification information, which is used to determine the corresponding target resource and filter out resources that do not need to be loaded. Determining the identification information through tag attributes can filter out redundant resources and facilitate the identification of target resources, thereby improving page loading speed. Simultaneously, by filtering tag attributes, resources can be segmented and preloaded for tag attributes containing different page paths, thereby improving the reliability of page rendering.

[0068] For example, injecting the page path into the tag attribute of the first template file in the above steps can be done by injecting the page path as a custom attribute into the tag attribute of the first template file.

[0069] For example, the filtering of tag attributes in the above steps to obtain identification information can be achieved by using regular expressions to filter tag attributes and obtain identification information.

[0070] It is understandable that, in addition to injecting the page path into the tag attributes of the first template file, page path parameters can also be injected into the tag attributes of the first template file. Besides using injection and filtering methods to determine identification information, logical operations can be performed on the page path to determine identification information, and partial information can be extracted from specific locations within the page path to determine identification information.

[0071] In one embodiment, before injecting the page path into the tag attributes of the first template file in the above steps, the determination of the target resource related to the access request in the first template file in step S100 further includes:

[0072] Intercept page paths.

[0073] After injecting the page path into the tag attributes of the first template file in the above steps, step S100, which involves determining the target resource in the first template file related to the access request, further includes:

[0074] Intercept the first template file.

[0075] In this embodiment, since the page path needs to be injected into the tag attributes of the first template file, the page path is intercepted to obtain the page path in response to the user's page access request. Since the target resource is a portion of the resources in the first template file, and page rendering should be avoided based on the first template file, the first template file is intercepted to determine the target resource. By intercepting the page path and the first template file, a second template file can be generated and the page rendered using the second template file, thereby improving the reliability of page rendering.

[0076] For example, the interception of the page path in the above steps can be implemented using middleware. Middleware can be an interceptor, a filter, etc. The interception of the first template file in the above steps can be implemented using a hook function. The generation of the second template file based on the target resource in step S200 can be implemented using a hook function.

[0077] For example, before intercepting the page path in the above steps, a first script can be created and registered in a configuration file to intercept the page path via middleware. Before intercepting the first template file in the above steps, a second script can be created and registered in a configuration file to intercept the first template file via a hook function.

[0078] In one embodiment, the generation of the second template file based on the target resource in step S200 can be determined in the following way:

[0079] The second template file is obtained by filtering out all resources except the target resource from the first template file.

[0080] In this embodiment, the second template file is obtained by filtering resources other than the target resource, thus avoiding the additional storage space occupied by extracting the target resource separately, thereby reducing the storage space occupied.

[0081] In one embodiment, the step S200 of generating the second template file based on the target resource can also be determined in the following way:

[0082] Generate a second template file from the target resource.

[0083] In this embodiment, by generating a second template file based on the target resource, the time spent filtering redundant resources is avoided, thereby improving the page loading speed.

[0084] In one embodiment, such as Figure 3 As shown, the generation of the second template file based on the target resource in step S200 can also be determined in the following way:

[0085] S210. Obtain target information. Target information is used to speed up page rendering.

[0086] S220. Generate a second template file based on the target information and target resources.

[0087] In this embodiment, since customized information can speed up page rendering, customized target information is obtained. Based on the target information and target resources, a second template file is generated to accelerate the loading speed of target resources using the target information. By obtaining the target information to generate the second template file, the customized information can be used to speed up the loading speed of target resources, thereby improving the page loading speed.

[0088] For example, the target information may include information pre-calculated and generated by the server, passed through hook functions to generate a second template file. Since the client does not need to perform calculations on this information, the computational burden on the client is reduced, thereby improving page rendering speed. The target information may also include prefetch and preconnect tags for target resources generated by the server. These tags guide the browser or related applications to efficiently load target resources, further improving page rendering speed. The target information may also include information integrating on-demand loading and third-party services, eliminating the need for repeated settings in each page or component, thus improving page rendering speed. The target information may also include custom information dynamically injected into the second template file by the server to optimize search engines, thereby improving page rendering speed. Finally, the target information may include Cascading Style Sheets (CSS) dynamically passed to the second template file by the server to achieve responsive design, further improving page rendering speed.

[0089] For example, in step S220, generating a second template file based on target information and target resources can be done by filtering resources other than target resources in the first template file and combining them with target information to generate a second template file, or it can be done by generating a second template file based on target resources and target information.

[0090] For example, during the rendering of the page based on the second template file in step S300, the target resources in the second template file need to be mounted on the root node, and at least some of the resources in the target resources need to be loaded and preloaded. After the page is rendered based on the second template file in step S300, the rendered page can be presented to the user.

[0091] In one embodiment, before rendering the page according to the second template file in step S300, the page rendering method further includes:

[0092] Implement security protection measures for access requests.

[0093] In this embodiment, by implementing security protection processing on access requests, information leakage in access requests is avoided, thereby improving the security of page rendering.

[0094] For example, the security protection processing of the access request in the above steps can be performed on the header information of the access request. For instance, fields in the header information can be encrypted or serialized.

[0095] In one embodiment, before rendering the page according to the second template file in step S300, the page rendering method further includes:

[0096] The second template file is protected against security measures.

[0097] In this embodiment, by implementing security protection measures on the second template file, information leakage from the second template file is avoided, thereby improving the security of page rendering.

[0098] For example, the security protection process for the second template file in the above steps can be to filter resource paths for information such as tag attributes in the second template file to prevent cross-site scripting (XSS) attacks.

[0099] For example, before rendering the page according to the second template file in step S300, the page rendering method further includes:

[0100] Security protection measures are implemented for access requests and second template files.

[0101] This disclosure provides a page rendering method, such as... Figure 4 As shown, the method includes:

[0102] S400: In response to a user's request to access a page, intercept the page path in the access request.

[0103] S410. Inject the page path into the tag attribute of the first template file.

[0104] S420, Intercept the first template file.

[0105] S430. Filter the tag attributes to obtain the identification information.

[0106] S440. Based on the identification information, determine the target resource corresponding to the first template file.

[0107] S450. Filter out all resources in the first template file except for the target resource to obtain the second template file.

[0108] S460: Perform security protection processing on access requests and second template files.

[0109] S470. Render the page according to the second template file.

[0110] In this embodiment, in response to a user's request to access a page, the page needs to be rendered to be presented to the user. The page path in the access request is intercepted and injected into the tag attributes of a first template file to determine the target resource. The first template file is intercepted to prevent page rendering using it. Tag attributes are filtered to extract identification information. Based on the identification information, the corresponding target resource in the first template file is determined through a mapping relationship. Resources in the first template file other than the target resource are filtered out to obtain a second template file, ensuring it does not contain redundant resources. Security protection measures are applied to the access request and the second template file to prevent information leakage. The page is rendered based on the second template file, allowing the user to access the page. By rendering the page using the target resource in the first template file, redundant resources in the first template file are avoided, enabling on-demand resource loading and thus improving page loading speed.

[0111] In one exemplary embodiment, a page rendering apparatus is provided for implementing the method described above. (Reference) Figure 5 As shown, the page rendering apparatus may include a determining module 100, a generating module 200, and a rendering module 300. During the implementation of the above method,

[0112] Module 100 is configured to determine the target resource in the first template file related to the access request in response to a user's access request to the page.

[0113] The generation module 200 is configured to generate a second template file based on the target resource.

[0114] Rendering module 300 is configured to render the page based on the second template file.

[0115] In one exemplary embodiment, a page rendering apparatus is provided, wherein a determining module 100 is configured to:

[0116] Determine the identification information based on the page path.

[0117] Based on the identification information, determine the target resource corresponding to the first template file.

[0118] In one exemplary embodiment, a page rendering apparatus is provided, the apparatus further comprising:

[0119] The injection module is configured to inject the page path into the tag attributes of the first template file.

[0120] In one exemplary embodiment, a page rendering apparatus is provided, the apparatus further comprising:

[0121] The filtering module is configured to filter tag attributes to obtain identification information.

[0122] In one exemplary embodiment, a page rendering apparatus is provided, the apparatus further comprising:

[0123] The interception module is configured to intercept page paths.

[0124] In one exemplary embodiment, a page rendering apparatus is provided, wherein an interception module is configured to:

[0125] Intercept the first template file.

[0126] In one exemplary embodiment, a page rendering apparatus is provided, wherein a generation module 200 is configured to:

[0127] The second template file is obtained by filtering out all resources except the target resource from the first template file.

[0128] In one exemplary embodiment, a page rendering apparatus is provided, wherein a generation module 200 is configured to:

[0129] Generate a second template file from the target resource.

[0130] In one exemplary embodiment, a page rendering apparatus is provided, wherein a generation module 200 is configured to:

[0131] Obtain target information, which is used to speed up page rendering.

[0132] A second template file is generated based on the target information and target resources.

[0133] In one exemplary embodiment, a page rendering apparatus is provided, the apparatus further comprising:

[0134] The protection module is configured to perform security protection processing on access requests and / or second template files.

[0135] In one exemplary embodiment, an electronic device is provided, such as a mobile phone, a laptop computer, a tablet computer, and a wearable device.

[0136] refer to Figure 6 As shown, the electronic device 400 may include one or more of the following components: processing component 402, memory 404, power supply component 406, multimedia component 408, audio component 410, input / output (I / O) interface 412, sensor component 414, and communication component 416.

[0137] Processing component 402 typically controls the overall operation of electronic device 400, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 402 may include one or more processors 420 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 402 may include one or more modules to facilitate interaction between processing component 402 and other components. For example, processing component 402 may include a multimedia module to facilitate interaction between multimedia component 408 and processing component 402.

[0138] Memory 404 is configured to store various types of data to support the operation of electronic device 400. Examples of this data include instructions for any application or method operating on electronic device 400, contact data, phonebook data, messages, pictures, videos, etc. Memory 404 can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0139] Power supply component 406 provides power to various components of electronic device 400. Power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 400.

[0140] Multimedia component 408 includes a screen that provides an output interface between electronic device 400 and user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 408 includes a front-facing camera module and / or a rear-facing camera module. When electronic device 400 is in an operating mode, such as shooting mode or video mode, the front-facing camera module and / or rear-facing camera module may receive external multimedia data. Each front-facing camera module and rear-facing camera module may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0141] Audio component 410 is configured to output and / or input audio signals. For example, audio component 410 includes a microphone (MIC) configured to receive external audio signals when electronic device 400 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 404 or transmitted via communication component 416. In some embodiments, audio component 410 also includes a speaker for outputting audio signals.

[0142] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0143] Sensor assembly 414 includes one or more sensors for providing state assessments of various aspects of electronic device 400. For example, sensor assembly 414 may detect the on / off state of electronic device 400, the relative positioning of components such as the display and keypad of electronic device 400, changes in position of electronic device 400 or a component of electronic device 400, the presence or absence of user contact with electronic device 400, orientation or acceleration / deceleration of electronic device 400, and temperature changes of electronic device 400. Sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 414 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0144] Communication component 416 is configured to facilitate wired or wireless communication between electronic device 400 and other terminals. Electronic device 400 can access wireless networks based on communication standards, such as WiFi, 2G, 3G, 4G, 5G, or combinations thereof. In one exemplary embodiment, communication component 416 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 416 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0145] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing terminals (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods shown in the above embodiments or combinations thereof.

[0146] In one exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, which can be executed by a processor 420 of an electronic device 400 to perform the methods shown in the embodiments or combinations thereof. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage terminal, etc. When the instructions in the storage medium are executed by the processor of the terminal, the terminal is able to perform the methods shown in the embodiments or combinations thereof.

[0147] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0148] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0149] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0150] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0151] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method of rendering a page, the method comprising: The page rendering method comprises: in response to a user's access request for a page, determining a target resource in a first template file related to the access request; generating a second template file according to the target resource; rendering the page according to the second template file.

2. The page rendering method of claim 1, wherein, The access request comprises a page path; The determination of the target resource in the first template file related to the access request comprises: determining identification information according to the page path; determining the corresponding target resource in the first template file according to the identification information.

3. The page rendering method of claim 2, wherein, Before the determination of the identification information according to the page path, the determination of the target resource in the first template file related to the access request further comprises: injecting the page path into a label attribute of the first template file; The determination of the identification information according to the page path comprises: filtering the label attribute to obtain the identification information.

4. The page rendering method of claim 3, wherein, Before the injection of the page path into the label attribute of the first template file, the determination of the target resource in the first template file related to the access request further comprises: intercepting the page path; After the injection of the page path into the label attribute of the first template file, the determination of the target resource in the first template file related to the access request further comprises: intercepting the first template file.

5. The page rendering method of claim 1, wherein, The generation of the second template file according to the target resource comprises: filtering resources in the first template file other than the target resource to obtain the second template file; or generating the second template file with the target resource.

6. The page rendering method of claim 1, wherein, The generation of the second template file according to the target resource comprises: obtaining target information, the target information being used to accelerate the rendering speed of the page; generating the second template file according to the target information and the target resource.

7. The page rendering method according to any one of claims 1 to 6, characterized in that, Before the rendering of the page according to the second template file, the page rendering method further comprises: performing security protection processing on the access request and / or the second template file.

8. A page rendering apparatus characterized by comprising: The page rendering apparatus comprises: a determination module configured to determine a target resource in a first template file related to a user's access request for a page in response to the access request; a generation module configured to generate a second template file according to the target resource; a rendering module configured to render the page according to the second template file.

9. An electronic device, comprising: The electronic device comprises: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to perform the page rendering method according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium, comprising: When the instructions in the storage medium are executed by the processor of the terminal, the terminal is enabled to perform the page rendering method according to any one of claims 1 to 7.