A page rendering method, device, electronic device and readable storage medium

By loading and rendering page data on the client, combining native web page tags and hybrid component protocols, the problem of low user experience and development efficiency in the existing technology is solved, and an efficient page rendering and development process is achieved.

CN113297522BActive Publication Date: 2024-11-22GUANGZHOU HUYA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110506397.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-10
Publication Date
2024-11-22
Estimated Expiration
2041-05-10

AI Technical Summary

Technical Problem

Existing client rendering page technology cannot provide a user experience similar to Native, and at the same time, the development efficiency is inefficient, and each APP update requires release, which increases the development difficulty and cycle.

Method used

Load page data through the client, including web page native component data and hybrid component protocol, render native web page tags, and obtain feature web page tags based on the hybrid component protocol, render to the corresponding location of feature web page tags in the native web interface, realizing two renderings to generate the full page.

Benefits of technology

It realizes a user experience similar to Native, while improving development efficiency, reducing the frequency and development difficulty of APP updates, and shortening the development cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113297522B_ABST
    Figure CN113297522B_ABST
Patent Text Reader

Abstract

The present application discloses a page rendering method, device, electronic device and storage medium. The page rendering method provided by the present application loads page data through a client, the page data includes webpage native component data and a hybrid component protocol, the webpage native component data includes native webpage tags, and the hybrid component protocol includes feature webpage tags that need to be rendered by the client and the location of the feature webpage tags; the native webpage tags are rendered to obtain a native webpage interface; and based on the hybrid component protocol, the feature webpage tags are obtained, and the feature webpage tags are rendered to the location corresponding to the feature webpage tags in the native webpage interface through the client, and the display page is obtained by two renderings. The page generated by the page rendering method of the present application includes both components of the original webpage page and native components of the client, which can ensure the high efficiency of development and the page can provide a user experience similar to Native.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a page rendering method, device, electronic device and readable storage medium. Background Art

[0002] As mobile phones, computers, tablets, smart watches and other terminals become more and more integrated into people's lives, users need to view and operate through the display pages on the terminals, so how to better render the pages becomes particularly important.

[0003] At present, the client-side rendering page technologies include client-side Native technology, WEB technology and JS Bridge, and ReactNative / Weex hybrid technology. However, the above technologies either cannot provide users with a Native-like user experience, or require a new version every time the APP is updated, which is not flexible enough, increasing the difficulty of application development for developers and greatly limiting the development efficiency of developers.

[0004] Therefore, it is crucial to ensure a Native-like user experience while improving development efficiency. Summary of the invention

[0005] The main technical problem solved by the present application is to provide a page rendering method, device, electronic device and readable storage medium to ensure a Native-like user experience while improving the development efficiency of developers.

[0006] In order to solve the above problems, the first aspect of the present application provides a page rendering method, which includes: a client loads page data, wherein the page data includes web page native component data and a hybrid component protocol; wherein the web page native component data includes native web page tags; the hybrid component protocol includes feature web page tags that need to be rendered by the client and the position of the feature web page tags; rendering the native web page tags to obtain a native web page interface; and based on the hybrid component protocol, obtaining the feature web page tags, and rendering the feature web page tags to the position corresponding to the feature web page tags in the native web page interface through the client.

[0007] In order to solve the above problems, the second aspect of the present application provides a page rendering device, including: a loading module, used for a client to load page data, wherein the page data includes web page native component data and a hybrid component protocol; wherein the web page native component data includes native web page tags; the hybrid component protocol includes feature web page tags that need to be rendered by the client and the position of the feature web page tags; a rendering module, rendering the native web page tags to obtain a native web page interface; and based on the hybrid component protocol, obtaining the feature web page tags, and rendering the feature web page tags to the position corresponding to the feature web page tags in the native web page interface through the client.

[0008] In order to solve the above problem, the third aspect of the present application provides an electronic device, including a memory and a processor coupled to each other, wherein the processor is used to execute program instructions stored in the memory to implement the page rendering method of the first aspect.

[0009] In order to solve the above-mentioned problem, the fourth aspect of the present application provides a computer-readable storage medium on which program instructions are stored, and when the program instructions are executed by a processor, the page rendering method of the above-mentioned first aspect is implemented.

[0010] The beneficial effects of the present application are as follows: Different from the prior art, the page rendering method provided by the present application loads page data through the client, and the page data includes web page native component data and hybrid component protocol, wherein the web page native component data includes native web page tags, and the hybrid component protocol includes feature web page tags that need to be rendered by the client and the location of the feature web page tags; the native web page tags are rendered to obtain a native web page interface; and based on the hybrid component protocol, the feature web page tags are obtained, and the feature web page tags are rendered to the location corresponding to the feature web page tags in the native web page interface through the client, thereby achieving two renderings through native web page rendering and client native rendering to obtain the displayed page. The page generated by the page rendering method of the present application includes both components of the original web page and client native components, which can ensure the efficiency of development and ensure that the page can provide a Native-like user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 This is a flow chart of an embodiment of page rendering provided by the present application;

[0012] Figure 2 It is a flowchart of another embodiment of page rendering provided by the present application;

[0013] Figure 3 It is a flowchart of a specific embodiment of page rendering provided by this application;

[0014] Figure 4 It is a schematic diagram of a framework of an embodiment of a device for page rendering provided by the present application;

[0015] Figure 5 It is a schematic diagram of the framework of an embodiment of the electronic device of the present application;

[0016] Figure 6 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0017] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0018] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0019] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. In addition, "many" in this article means two or more than two.

[0020] In this application, a terminal refers to a "dumb" user device that is connected to a centralized host system. The terminal receives keyboard input from the user and sends this input to the host system. The host system processes the user's keyboard input and commands, and then the output is returned and displayed on the terminal's screen. Personal computers can run some programs called terminal emulators to simulate the operation of a dumb terminal.

[0021] Client is also called user end, which is a program that provides local services to clients, corresponding to the server. Except for some applications that only run locally, they are generally installed on ordinary client computers and need to cooperate with the server to run. After the development of the Internet, the more commonly used user ends include web browsers used for the World Wide Web, email clients for sending and receiving emails, and client software for instant messaging. For this type of application, there needs to be corresponding servers and service programs in the network to provide corresponding services, such as database services, email services, etc. Therefore, specific communication connections need to be established between the client and the server to ensure the normal operation of the application.

[0022] See also Figure 1 , Figure 1This is a flow chart of an embodiment of page rendering provided by the present application. Specifically, it may include the following steps:

[0023] Step S11: The client loads page data, wherein the page data includes webpage native component data and hybrid component protocol; wherein the webpage native component data includes native webpage tags; the hybrid component protocol includes feature webpage tags that need to be rendered by the client and the location of the feature webpage tags.

[0024] Among them, the hybrid component protocol is jointly formulated in advance by the web developer and the client developer, and both the browser kernel and the client will comply with this hybrid component protocol. Specifically, the hybrid component protocol can be embedded in the native component data of the web page. The characteristic web page tags that need to be rendered by the client are the web page tags corresponding to the components that need to be rendered by the client. Among them, the components that need to be rendered by the client can be based on actual development needs or page display needs. For example, components that consume relatively large performance can be used as components that need to be rendered by the client.

[0025] After the client loads the page data including the page native component data and the hybrid component protocol, step S12 is performed.

[0026] Step S12: Render the native web page tag to obtain the native web page interface; and based on the hybrid component protocol, obtain the feature web page tag, and render the feature web page tag to the position corresponding to the feature web page tag in the native web page interface through the client.

[0027] In the previous step, the client performs two renderings based on the loaded web native component data including native web page tags, and the hybrid component protocol including the feature web page tags that need to be rendered by the client and the location of the feature web page tags. The renderings are respectively: rendering the native web page tags to obtain the native web page interface; and rendering the feature web page tags through the client based on the hybrid component protocol to obtain a complete web page.

[0028] In a specific embodiment, the rendering of the native web page tag and the rendering of the characteristic web page tag through the client based on the hybrid component protocol can be performed simultaneously, and the rendering and display are performed according to the positions corresponding to the tags.

[0029] In another specific embodiment, the two renderings of rendering the native web page tag and rendering the characteristic web page tag through the client based on the hybrid component protocol can be performed in a sequential order. For example, the native web page tag is rendered first, and the native web page interface and the original web page component are generated at the corresponding position. Then, the characteristic web page tag is rendered through the client based on the hybrid component protocol, and rendered and displayed at the position corresponding to the characteristic web page tag in the native web page interface.

[0030] In this step, the step of rendering the native web page tag to obtain the native web page interface may specifically include the browser kernel parsing the native web page tag and rendering the native web page tag. For example, the browser kernel processes the native web page tag to obtain a document object model tree (DOM tree), and then obtains the native web page interface based on the DOM tree.

[0031] The page rendering method provided in this implementation loads page data through the client, and the page data includes webpage native component data and hybrid component protocol, wherein the webpage native component data includes native webpage tags, and the hybrid component protocol includes feature webpage tags that need to be rendered by the client and the location of the feature webpage tags; the native webpage tags are rendered to obtain the native webpage interface; and based on the hybrid component protocol, the feature webpage tags are obtained, and the feature webpage tags are rendered to the location corresponding to the feature webpage tags in the native webpage interface through the client, thereby achieving the display page through two renderings of native webpage rendering and client native rendering. The page generated by the page rendering method of this application includes both components of the original webpage page and client native components, which can ensure the efficiency of development and the page can provide a user experience similar to Native.

[0032] See also Figure 2 , Figure 2 This is a flow chart of another embodiment of page rendering provided by the present application. Specifically, it may include the following steps:

[0033] Step S21: The client loads page data, wherein the page data includes webpage native component data and hybrid component protocol; wherein the webpage native component data includes native webpage tags; the hybrid component protocol includes feature webpage tags that need to be rendered by the client and the location of the feature webpage tags.

[0034] This step is the same as step S11. For details, please refer to the relevant text description of step S11, which will not be repeated here.

[0035] Step S22: Render the native web page tag to obtain the native web page interface; and based on the hybrid component protocol, obtain the feature web page tag, and render the feature web page tag to the corresponding position of the preset layer corresponding to the feature web page tag in the native web page interface through the client.

[0036] In this step, the native web page interface and corresponding components obtained by rendering the native web page tag have a certain hierarchy, and the components corresponding to the feature web page tag also have a corresponding hierarchy, that is, a preset layer. The hierarchy setting can improve the display effect of the page after two renderings and avoid mutual coverage and occlusion between components. It can be understood that the preset layer corresponding to the web page tag can be the same as the hierarchy corresponding to the native web page tag, or it can be different, and can be set accordingly according to the desired display effect.

[0037] Specifically, the step of rendering the feature web page tag to the corresponding position of the preset layer corresponding to the feature web page tag in the native web page interface through the client includes: using the browser kernel of the client to parse the hierarchical relationship between the feature web page tag and the native web page tag, that is, the hierarchical relationship between the component corresponding to the feature web page tag and the component corresponding to the native web page tag. The hierarchical relationship can be the same level or different levels. Then, based on the hierarchical relationship, the feature web page tag is rendered to the corresponding position of the preset layer corresponding to the feature web page tag in the native web page interface, thereby avoiding the display area and components rendered twice from blocking and covering each other.

[0038] The page rendering method provided in this implementation performs native web page tag rendering and rendering of characteristic web page tags through the client based on the hybrid component protocol, thereby generating components of the native web page interface and the original web page and client native components, and avoids the problem of mutual overlap between components in the web page interface by setting the hierarchical relationship, thereby achieving a better page display effect. It can not only ensure the efficiency of development, but also ensure that the page can provide a user experience similar to Native. When the components corresponding to the native web page need to be modified and updated in the application APP, there is no need to release the application APP, which greatly reduces the development difficulty and shortens the cycle of developing the application APP and updating it, thereby improving development efficiency.

[0039] Furthermore, the native web page tag can be an HTML tag. Figure 3 , Figure 3 It is a flowchart of a specific embodiment of page rendering provided by this application.

[0040] Step S31: The client loads page data, wherein the page data includes webpage native component data and hybrid component protocol; wherein the webpage native component data includes HTML tags; the hybrid component protocol includes characteristic webpage tags that need to be rendered by the client and the location of the characteristic webpage tags.

[0041] In this step, the webpage native component data includes HTML tags, which are hypertext markup language tags and are the most basic units in the HTML language. The hybrid component protocol is jointly formulated by webpage developers and client developers, and both the browser kernel and the client will comply with this hybrid component protocol.

[0042] Step S32: Render the HTML tags, and execute the CSS style files and JS script files in the webpage native component data to generate a native webpage interface; wherein the position corresponding to the characteristic webpage tag in the native webpage interface is blank.

[0043] When developing a page, network web technology is used, namely HTML+JS+CSS, where HTML defines the meaning and structure of the web page content; JS defines the performance and display effects of the web page; and CSS defines the functions and behaviors of the web page.

[0044] In this step, the HTML tags are rendered, and the native web page interface is generated by combining the CSS style file and the JS script file. As for the position corresponding to the characteristic web page tag, since the browser cannot parse its content, it cannot be rendered, so its corresponding position is blank.

[0045] Step S33: Rendering the characteristic web page tag to a blank position corresponding to the characteristic web page tag in the native web page interface through the client.

[0046] The client parses and renders the characteristic web page tags to the corresponding blank positions in the web page interface, thus achieving the complete display of the web page interface.

[0047] In a specific embodiment, the loaded page data includes the following code:

[0048]

[0049] <video>< / video>

[0050] <abcd>< / abcd>

[0051]

[0052] The "video" tag can be parsed and rendered by the browser, and a video component is displayed on the page. The "abcd" tag is a custom, non-standard tag, and the browser cannot recognize and parse the content of this custom tag, so the corresponding position in the page is blank. Then, the client parses the "abcd" tag according to the hybrid component protocol and renders it to the blank space corresponding to the "abcd" tag in the page, thereby displaying the entire page.

[0053] The page rendering method provided in this implementation performs native web page HTML tag rendering and characteristic web page tags rendering through the client based on the hybrid component protocol, thereby generating a native web page interface and components of the original web page and client native components to achieve better page display effects. It can also ensure the efficiency of development and ensure that the page can provide a Native-like user experience. When the components corresponding to the native web page need to be modified and updated in the application APP, there is no need to release the application APP, which greatly reduces the development difficulty and shortens the cycle of developing the application APP and updating it, thereby improving development efficiency.

[0054] See also Figure 4 , Figure 4 It is a schematic diagram of the framework of an embodiment of a device for page rendering provided by the present application. The device 40 for page rendering includes: a loading module 41, which is used for loading page data on the client, wherein the page data includes webpage native component data and a hybrid component protocol; wherein the webpage native component data includes native webpage tags; the hybrid component protocol includes feature webpage tags that need to be rendered by the client and the location of the feature webpage tags; a rendering module 42, which is used for rendering the native webpage tags to obtain a native webpage interface; and based on the hybrid component protocol, obtaining the feature webpage tags, and rendering the feature webpage tags to the location corresponding to the feature webpage tags in the native webpage interface through the client.

[0055] In the above scheme, after the loading module 41 loads the page data, the rendering module 42 renders the native web page tag to obtain the native web page interface; and based on the hybrid component protocol, the characteristic web page tag is obtained, and the characteristic web page tag is rendered to the position corresponding to the characteristic web page tag in the native web page interface through the client, thereby realizing the rendering of the native web page HTML tag and the rendering of the characteristic web page tag through the client based on the hybrid component protocol, generating the components of the native web page interface and the original web page and the client native components, and achieving better page display effects. It can not only ensure the efficiency of development, but also ensure that the page can provide a user experience similar to Native. When the components corresponding to the native web page need to be modified and updated in the application APP, there is no need to release the application APP, which greatly reduces the development difficulty and shortens the cycle of developing the application APP and updating it, and improves development efficiency.

[0056] In other embodiments, the rendering module 42 may also be used to render the characteristic web page tag to a corresponding position of a preset layer corresponding to the characteristic web page tag in the native web page interface through the client. Further, the rendering module 42 is used to parse the hierarchical relationship between the characteristic web page tag and the native web page tag using the browser kernel of the client; based on the hierarchical relationship, the characteristic web page tag is rendered to a corresponding position of the preset layer corresponding to the characteristic web page tag in the native web page interface.

[0057] Furthermore, the rendering module 42 can also be used to parse native web page tags and render the native web page tags. Specifically, the rendering module 42 is used to process the native web page tags to obtain a document object model tree, and obtain a native web page interface based on the document object model tree.

[0058] When the native web page tag is an HTML tag, the rendering module 42 can also be used to render the HTML tag, and execute the CSS style file and the JS script file in the native component data of the web page to generate a native web page interface; wherein the position corresponding to the feature web page tag in the native web page interface is blank; and the feature web page tag is rendered to the blank position corresponding to the feature web page tag in the native web page interface through the client.

[0059] See also Figure 5 , Figure 5 1 is a schematic diagram of a framework of an embodiment of an electronic device of the present application. The electronic device 50 includes a memory 51 and a processor 52 coupled to each other, and the processor 52 is used to execute program instructions stored in the memory 51 to implement the steps of any of the above-mentioned page rendering method embodiments. In a specific implementation scenario, the electronic device 50 may include but is not limited to: a microcomputer, a server.

[0060] Specifically, the processor 52 is used to control itself and the memory 51 to implement the steps of any of the above-mentioned graph data partitioning method embodiments. The processor 52 can also be called a CPU (Central Processing Unit). The processor 52 may be an integrated circuit chip with signal processing capabilities. The processor 52 can 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 devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 52 can be implemented by an integrated circuit chip.

[0061] In the above scheme, the processor 52 renders the native web page tags after loading the page data, and renders the characteristic web page tags through the client based on the hybrid component protocol, thereby generating the native web page interface and the components of the original web page and the client native components, and avoiding the problem of mutual overlap between the components in the web page interface by setting the hierarchical relationship, and achieving a better page display effect. It can not only ensure the efficiency of development, but also ensure that the page can provide a user experience similar to Native. When the components corresponding to the native web page need to be modified and updated in the application APP, there is no need to release the application APP, which greatly reduces the development difficulty and shortens the cycle of developing the application APP and updating it, thereby improving development efficiency.

[0062] See also Figure 6 , Figure 6 The computer-readable storage medium 60 stores program instructions 600 that can be executed by a processor, and the program instructions 600 are used to implement the steps of any of the above-mentioned page rendering method embodiments.

[0063] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0064] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0065] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0066] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

Claims

1. A page rendering method, characterized in that: include: The client loads page data, wherein the page data includes webpage native component data and hybrid component protocol; wherein the webpage native component data includes native webpage tags; the hybrid component protocol includes feature webpage tags that need to be rendered by the client and the location of the feature webpage tags; Rendering the native web page tag to obtain a native web page interface; wherein the position corresponding to the characteristic web page tag in the native web page interface is blank; and Based on the hybrid component protocol, the feature web page tag is obtained, and the feature web page tag is rendered to the position corresponding to the feature web page tag in the native web page interface through the client; specifically including: rendering the feature web page tag to the corresponding position of the preset layer corresponding to the feature web page tag in the native web page interface through the client; specifically including: using the browser kernel of the client to parse the hierarchical relationship between the feature web page tag and the native web page tag; based on the hierarchical relationship, rendering the feature web page tag to the corresponding position of the preset layer corresponding to the feature web page tag in the native web page interface.

2. The page rendering method according to claim 1, characterized in that: The native web page tag is an HTML tag; The step of rendering the native web page tag to obtain a native web page interface includes: Rendering the HTML tags, and executing the CSS style files and JS script files in the webpage native component data to generate the native webpage interface; The step of rendering the feature web page tag to a corresponding position of a preset layer corresponding to the feature web page tag in the native web page interface through the client includes: The client renders the feature web page tag to a blank position corresponding to the feature web page tag in the native web page interface.

3. The page rendering method according to claim 1, characterized in that: The step of rendering the native web page tag to obtain a native web page interface includes: The browser kernel parses the native web page tag and renders the native web page tag.

4. The page rendering method according to claim 3, characterized in that: The step of the browser kernel parsing the native web page tag and rendering the native web page tag includes: The browser kernel processes the native web page tag to obtain a document object model tree; Based on the document object model tree, the native web page interface is obtained.

5. The page rendering method according to claim 1, characterized in that: The hybrid component protocol is embedded in the webpage native component data.

6. A device for page rendering, characterized in that: include: A loading module, used for loading page data on a client, wherein the page data includes webpage native component data and a hybrid component protocol; wherein the webpage native component data includes native webpage tags; and the hybrid component protocol includes feature webpage tags that need to be rendered by the client and the location of the feature webpage tags; A rendering module, used for rendering the native web page tag to obtain a native web page interface; wherein the position corresponding to the characteristic web page tag in the native web page interface is blank; and Based on the hybrid component protocol, the feature web page tag is obtained, and the feature web page tag is rendered to the position corresponding to the feature web page tag in the native web page interface through the client; specifically including: rendering the feature web page tag to the corresponding position of the preset layer corresponding to the feature web page tag in the native web page interface through the client; specifically including: using the browser kernel of the client to parse the hierarchical relationship between the feature web page tag and the native web page tag; based on the hierarchical relationship, rendering the feature web page tag to the corresponding position of the preset layer corresponding to the feature web page tag in the native web page interface.

7. An electronic device, characterized in that: It comprises a memory and a processor coupled to each other, wherein the processor is used to execute program instructions stored in the memory to implement the page rendering method according to any one of claims 1 to 5.

8. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the page rendering method according to any one of claims 1 to 5 is implemented.