CN113434142A - Webpage output method, device, equipment and storage medium - Google Patents

Webpage output method, device, equipment and storage medium Download PDF

Info

Publication number
CN113434142A
CN113434142A CN202110767065.9A CN202110767065A CN113434142A CN 113434142 A CN113434142 A CN 113434142A CN 202110767065 A CN202110767065 A CN 202110767065A CN 113434142 A CN113434142 A CN 113434142A
Authority
CN
China
Prior art keywords
webpage
file
page
rendering
complete
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.)
Withdrawn
Application number
CN202110767065.9A
Other languages
Chinese (zh)
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.)
Shenzhen Nearbyexpress Technology Development Co Ltd
Original Assignee
Shenzhen Nearbyexpress Technology Development 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 Shenzhen Nearbyexpress Technology Development Co Ltd filed Critical Shenzhen Nearbyexpress Technology Development Co Ltd
Priority to CN202110767065.9A priority Critical patent/CN113434142A/en
Publication of CN113434142A publication Critical patent/CN113434142A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • 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
    • 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
    • G06F16/986Document structures and storage, e.g. HTML extensions

Abstract

The embodiment of the invention discloses a method, a device, equipment and a storage medium for outputting a webpage. The method comprises the following steps: sending a webpage loading request to a server; acquiring a complete webpage file returned by the server according to the webpage loading request, wherein the complete webpage file is generated by rendering the server according to the webpage loading request; displaying the webpage according to the complete webpage file; performing page rendering based on the webpage to obtain a client rendering file; and binding the page interaction events based on the webpage according to the client rendering file and the complete webpage file. The embodiment of the invention carries out rendering generation of the complete webpage file by the server, so that the client can directly display the webpage, the response speed of the first screen is improved, and the webpage rendering is independently carried out at the client to carry out the binding of the webpage interaction events, thereby avoiding the webpage output error caused by the mistake of the complete webpage file obtained from the server.

Description

Webpage output method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of internet, in particular to a webpage output method, a webpage output device, a webpage output equipment and a webpage output storage medium.
Background
Currently, mainstream front-end development is to use a client to render an MVVM frame, that is, a user sends a request to a server to obtain resources such as HTML (hypertext markup language), and then locally construct an application at the client to generate a complete HTML document, and then render an HTML string template at a client browser to render a page to realize webpage output. With the development of internet technology, server-side rendering is gradually becoming a common technical means, that is, an application is built at a server side to generate a complete HTML document, so that a client side is used for directly receiving the complete HTML document rendered by the server and analyzing the HTML document to display a corresponding webpage through a client-side browser, the way improves the first-screen display speed, but the server and the client side are different, the complete HTML document rendered by the server side is likely to have problems in the rendering process and the transmission process, and the possibility of errors when the client side outputs the webpage according to the complete HTML document is higher. Therefore, how to take account of the first screen time and the accurate webpage display becomes a problem.
Disclosure of Invention
In view of this, the invention provides a method and an apparatus for outputting a web page, an electronic device, and a storage medium, in which a complete web page file is obtained by rendering at a server, so that the first screen time of a client is shortened, and the accuracy of finally outputting a web page is ensured by performing the rendering of the web page at the client again.
In a first aspect, an embodiment of the present invention provides a method for outputting a web page, including:
sending a webpage loading request to a server;
acquiring a complete webpage file returned by the server according to the webpage loading request, wherein the complete webpage file is generated by rendering the server according to the webpage loading request;
displaying a webpage according to the complete webpage file;
performing page rendering based on the webpage to obtain a client rendering file;
and binding page interaction events based on the webpage according to the client rendering file and the complete webpage file.
In a second aspect, an embodiment of the present invention provides a method for outputting a web page, which is applied to a server and includes:
receiving a webpage loading request sent by a client;
constructing a webpage according to the webpage loading request, and rendering the webpage to obtain a complete webpage file;
and sending the complete webpage file to a client.
In a third aspect, an embodiment of the present invention further provides a web page output apparatus, including:
the sending module is used for sending a webpage loading request to the server;
the receiving module is used for acquiring a complete webpage file returned by the server according to the webpage loading request, wherein the complete webpage file is generated by rendering the server according to the webpage loading request;
the page display module is used for displaying a webpage according to the complete webpage file;
the rendering module is used for performing page rendering on the basis of the webpage to obtain a client rendering file;
and the interactive binding module is used for binding the page interactive events based on the webpage according to the client rendering file and the complete webpage file.
In a fourth aspect, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the web page output method provided by any embodiment of the present invention.
In a fifth aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the web page output method provided in any embodiment of the present invention.
The embodiment of the invention provides a webpage output method, which comprises the steps that a client sends a webpage loading request to a server, the server generates and returns a complete webpage file according to the webpage loading request, the client displays a webpage based on the complete webpage file, performs webpage rendering based on the webpage to obtain a client rendering file for binding a webpage interaction event, and finally performs the binding of the webpage interaction event according to the complete webpage file and the client rendering file to complete the complete output of a webpage, the method generates the rendering of the complete webpage and delivers the rendering to the server completely, so that the client can quickly display the first screen according to the complete webpage file, and the client independently performs page rendering once to obtain a client rendering file for binding the page interaction event, so that the complete webpage file can be verified, and the webpage output is accurate and error-free.
Drawings
Fig. 1 is a flowchart of a method for outputting a web page according to an embodiment of the present invention;
fig. 2 is a sub-flowchart of a web page output method according to a second embodiment of the present invention;
fig. 3 is a sub-flowchart of a web page output method according to a second embodiment of the present invention;
fig. 4 is a flowchart of a web page output method according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of a web page output device according to a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a web page output device according to a fifth embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to a sixth embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the steps as a sequential process, many of the steps can be performed in parallel, concurrently or simultaneously. In addition, the order of the steps may be rearranged. A process may be terminated when its operations are completed, but may have additional steps not included in the figure. A process may correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
Furthermore, the terms "first," "second," and the like may be used herein to describe various orientations, actions, steps, elements, or the like, but the orientations, actions, steps, or elements are not limited by these terms. These terms are only used to distinguish one direction, action, step or element from another direction, action, step or element. The terms "first", "second", etc. are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present invention, "plurality", "batch" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Example one
The invention provides a webpage output method, which is applied to a browser system for providing web services. Based on the above system, the web page output method provided in this embodiment may be executed by a client, and the client may provide desktop applications such as a desktop browser Chrome, a Firfox, a QQ browser, and an Edga based on various platforms (Windows, Mac os, Android, iPhone ios, and the like), and specifically implemented by interaction between the client and a server, as shown in fig. 1, the method specifically includes:
and S110, sending a webpage loading request to the server.
The webpage loading request is generated by the client based on the browser and used for requesting the server to acquire various resources (such as HTML files, JS and CSS resources) for generating the webpage at the client, wherein the resources exist in different forms in different browser systems. The web page loading request may be specifically set according to different browser systems, or may also adopt a unified conventional setting, which needs to include access information for determining web page access content, and in some embodiments, may also need to include content such as authentication information, and is not limited herein.
Specifically, in this embodiment, a terminal (e.g., a mobile phone, a tablet, a palmtop, etc.) provides a web page access function based on various individual browser applications or webviews built in browsers embedded in application programs, such as wechat, nails, etc., when a user accesses some web pages by using the terminal based on the browser and inputting URLs (Uniform Resource locators), the terminal generates a web page loading request according to a web address accessed by the user, where the web page loading request includes web address information, and may also include account information, terminal information, and the like.
And S120, acquiring a complete webpage file returned by the server according to the webpage loading request, wherein the complete webpage file is generated by rendering the server according to the webpage loading request.
A full web page file refers to a full HTML document that can be used directly as a file for web page display. In the foregoing, it has been mentioned that the client needs to use various resources when generating the web page, and for a browser system in which the client constructs the application, the resources are discrete, and often the client needs to request data again after acquiring the HTML file, and then constructs the application according to the resources to generate the complete web page file, which is different in this embodiment. In this embodiment, after receiving the web page loading request, the server directly obtains various resources for generating the corresponding web page according to the web page loading request, constructs an application according to the resources, obtains a complete web page file after successful construction, and returns the complete web page file to the corresponding terminal according to the web page loading request.
Specifically, in some examples, the server is a WEB server constructed by nodeJs, and after receiving the WEB page loading request, the server accesses corresponding data according to the website information in the WEB page loading request, constructs an application by using JS, renders a complete WEB page file, that is, a complete HTML document, and transmits the complete HTML document back to the terminal that initiated the WEB page loading request through the network.
And S130, displaying the webpage according to the complete webpage file.
The step S130 indicates that only the text, picture, and other information of the web page is normally displayed, and the interactive function provided by the web page cannot be directly used. The method aims to quickly realize the display of the first screen page at the client, so that a user can directly view information displayed by the webpage, and the time for the user to wait for the loading of the webpage is reduced. However, the user often does not need to use the interactive function of the web page immediately when accessing the web page, for example, when the user uses a search, the user needs to input characters in the search box first and then click the "search" option, and step S130 can already realize that the user inputs a problem into the input box after displaying the web page, so that the user cannot be influenced by normally accessing the web page before clicking the "search" option, the influence on the user is not great, and the time for the user to wait for the display of the web page is reduced by quickly providing the web page instead.
And S140, performing page rendering based on the webpage to obtain a client rendering file.
The rendering file of the client is used for realizing the function of the page component, the final output of the web page is not only the display of the page elements such as characters and pictures, but also the interaction function between the page elements supported by the page component and the user, and is a part of the output of the web page, in this embodiment, the complete web page file has resources with the same function as the rendering file of the client, so that the complete web page file can realize the display of the page elements and the interaction of the page elements, while the display of the page elements is realized only based on the complete web page file in step S130, step S140 is actually that the client performs page rendering based on the page elements displayed by the complete web page file, and generates the file for realizing the interaction of the page elements again, that is, two files for realizing the interaction of the page elements exist at the client, and one file is generated by the client (i.e. the rendering file of the client), and the other generated by the server (in the full web page file).
S150, binding page interaction events based on the webpage according to the client rendering file and the complete webpage file.
The page interaction event binding is to bind an interaction function realized by a page component with a page element, so that a user can realize a corresponding function when interacting with the page element displayed by a page through a browser, for example, calling a special interface setting, expanding a subordinate option of a certain option, and the like. The output of the web page can be realized only when the web page is successfully displayed and the page interaction event is successfully bound.
Specifically, in this embodiment, after the client rendering file is generated, it is necessary to verify whether the page interaction event binding results of the client rendering file and the complete web page file are consistent, and if the two page interaction event binding results are consistent, it is indicated that the complete web page file is accurate, and the page interaction event binding can be directly performed. It can be understood that the actual environments of the client and the server are different, and the complete webpage file may be damaged or abnormal when being transmitted to the client, so that the output of the webpage is affected, and the rendering and verification performed again at the client is equivalent to one-time security detection, so that the finally output webpage is safe and effective.
The embodiment provides a webpage output method, which comprises the steps of firstly sending a webpage loading request to a server by a client, generating and returning a complete webpage file by the server according to the webpage loading request, firstly displaying a webpage based on the complete webpage file by the client, then performing page rendering based on the webpage to obtain a client rendering file for performing page interaction event binding, finally performing page interaction event binding according to the complete webpage file and the client rendering file to complete the complete output of a webpage, the method generates the rendering of the complete webpage and delivers the rendering to the server completely, so that the client can quickly display the first screen according to the complete webpage file, and the client independently performs page rendering once to obtain a client rendering file for binding the page interaction event, so that the complete webpage file can be verified, and the webpage output is accurate and error-free.
Example two
In this embodiment, based on the first embodiment, a part of processes of the web page output method is further explained and supplemented, for example, a specific process of performing page rendering based on a web page and a process of performing page interaction event binding according to a client rendering file and a complete web page file, which are specifically as follows:
as shown in fig. 2, in the web page output method provided in this embodiment, step S140 includes steps S141 to 142:
and S141, acquiring the JS request script from the complete webpage file so as to construct an application through the JS request script.
The JS request script is a JS-based script for initiating static resources (resources such as JS and CSS) to the browser and constructing an application by using the static resources, and the JS script is usually in an HTML document, and for the embodiment, the JS script is in a complete webpage file.
S142, searching a page component corresponding to the webpage through the application to render the webpage, and generating DOM data of elements required by the webpage in the application.
After the application of step S141 is constructed, the routing is skipped, a page component corresponding to the web page is searched in the routing table for page rendering, DOM data of elements required by the page is generated in the application, and the DOM data is structural data and can form a node tree using the elements required by the page.
Optionally, in some embodiments, the complete webpage file includes first DOM data, and the client rendered file includes second DOM data, as shown in fig. 3, step S150 includes steps S151 to 153:
s151, verifying whether the first DOM data and the second DOM data are consistent or not.
As mentioned above, DOM data is generated when rendering is performed based on a page component, and both of a complete webpage file and a client rendered file necessarily contain DOM data, and in order to facilitate distinction, DOM data in the complete webpage file is referred to as first DOM data, DOM data in the client rendered file is referred to as second DOM data, and under a normal condition, the two DOM data should be consistent, so that when verifying whether the complete webpage file is normal based on the client rendered file, a mode of verifying whether the first DOM data and the second DOM data are consistent is adopted.
As mentioned above, the DOM data can form a node tree using elements required by the page, and when performing comparison verification on the DOM data, if the verification algorithm adopted by the verification is too complex, the browser will react too slowly, which may affect the user experience, so that optionally, in some embodiments, step S151 includes steps S1511-1512 (not shown):
s1511, determining the number of page nodes according to the display page, and selecting a preset verification algorithm according to the number of the page nodes.
S1512, verifying whether the first DOM data and the second DOM data are consistent or not according to the preset verification algorithm.
The DOM data form a node tree, the more nodes the DOM data are, the more complex the DOM data are, the more the DOM data complexity is judged according to the number of the page nodes in the steps S1511-1512, so that the simpler verification algorithm is selected when the number of the page nodes is larger, the verification efficiency is improved, and the page loading speed is increased.
S152, if the two DOM data are inconsistent, the webpage is kept displayed, and the first DOM data or the second DOM data is selected to bind the page interaction event according to a preset rule.
If the first DOM data and the second DOM data are inconsistent, it may be that a problem occurs in the generation, transmission, analysis and other processes of the complete webpage file, and a problem may also occur in the browser of the client. Under the condition that the cause of the problem (whether the first DOM data is wrong or the second DOM data is wrong) can be detected, correct DOM data can be selected for binding the page interaction events, but the problem is usually not determined to be willing, so that one DOM data needs to be selected for binding the page interaction events according to some set preset rules.
Optionally, in some embodiments, the previous selection of the first DOM data and the second DOM is decided by the user, i.e. step S152 includes steps S1521-1522 (not shown):
s1521, rendering selection options are displayed based on the webpage, and selection operation of a user based on the rendering selection options is obtained.
S1522, binding a page interaction event with the corresponding first DOM data or the second DOM data according to the selection operation of the user.
Rendering selection options are provided by the browser when the first DOM data and the second DOM data are inconsistent, displayed through a webpage, include error prompts to prompt a user that a data inconsistency currently occurs, and provide two options: the first option is used for selecting the first DOM data to perform page interaction event binding; the second option is used for selecting second DOM data to perform page interaction event binding. In some embodiments, rendering the selection option further includes a difference prompt message to prompt the user of a difference between the first DOM data and the second DOM data when the page interaction event is bound, i.e., a difference in final webpage output, so as to facilitate the user to know details of the webpage that will be obtained by the corresponding selection.
S153, if the two DOM data are consistent, the webpage is kept to be displayed, and the first DOM data or the second DOM data is selected optionally to bind the page interaction event.
When the first DOM data is consistent with the second DOM data, the result of the page interaction event binding of the first DOM data and the second DOM data is the same, so that one DOM data can be selected optionally for binding the page interaction event.
On the basis of the foregoing embodiment, the embodiment further specifically explains a specific process of performing page rendering based on a webpage, and describes a process of performing page interaction event binding according to a client rendering file and a complete webpage file, verifies a difference between rendering results of the client and the server by comparing DOM data, further provides a process of selecting a verification algorithm according to the number of webpage nodes, and further provides a way for a user to select a client rendering result or a server rendering result by himself to perform webpage output under the condition of a difference in rendering results, so that on the premise of ensuring safety and accuracy of webpage output, browser functions are enriched, and user experience is improved.
EXAMPLE III
A third embodiment of the present invention provides a web page output method applied to a server, where the method may be implemented by combining the web page output method applied to a client provided in any of the foregoing embodiments, and specifically, as shown in fig. 4, the web page output method provided in this embodiment includes:
s310, receiving a webpage loading request sent by a client.
The webpage loading request is generated by the client based on the browser and used for requesting the server to acquire various resources (such as HTML files, JS and CSS resources) for generating the webpage at the client, wherein the resources exist in different forms in different browser systems. The web page loading request may be specifically set according to different browser systems, or may adopt a unified conventional setting, which needs to include access information for determining web page access content, and in some embodiments, may also need to include content such as authentication information.
S320, constructing a webpage according to the webpage loading request, and rendering the webpage to obtain a complete webpage file.
The server side determines the webpage (URL) which needs to be accessed by the user according to the webpage loading request, constructs the application according to the webpage which needs to be accessed, and acquiring data according to the requirement, wherein the acquiring data refers to that when the server side constructs the routing page component, if the interface data needs to be acquired for page rendering, the interface data needs to be acquired first, and certainly the interface data does not need to be acquired when the data acquisition is not needed, after the application is built, the server executes scripts such as JS and the like to acquire data required by the webpage and renders a complete HTML document, thus obtaining the complete webpage file, wherein the complete webpage file contains all data required by the webpage, such as data for displaying a static web page and DOM data for binding interaction events, but does not bind interaction events to web pages, but exists separately, that is, the DOM data in the complete web page file is not used when the client renders and presents the complete web page file.
And S330, sending the complete webpage file to a client.
And the server returns the complete webpage file to the client according to the access path of the webpage loading request sent by the client, so that the client outputs the webpage according to the complete webpage file.
Optionally, in some embodiments, the building of the page according to the web page loading request in step S320 specifically includes steps S321-324 (not shown):
s321, analyzing the webpage loading request to determine the access URL of the request.
The web page loading request includes an access URL (Uniform Resource Locator) input by the user based on the browser, and is used for jumping to access data through the server. The server side obtains the final true visit URL according to the visit URL (usually, the visit URL is the final true visit URL).
S322, verifying whether the access URL is legal or not according to preset configuration.
The preset configuration is generally set according to different browsers and different access URLs, and is used for verifying whether a client initiating an access qualifies as an access URL, for example, the preset configuration is configured to verify whether request parameters in a web page loading request meet preset requirements, and the request parameters include, but are not limited to, parameters such as IP, ID, and time.
And S323, if so, constructing the webpage oriented by the access URL.
After the access URL is verified to be legal, the server side can acquire the resources of the webpage oriented by the access URL, so that the oriented webpage of the access URL is constructed, and a complete webpage file is generated.
And S324, if not, constructing a preset page.
After the access URL is verified to be illegal, the server redirects to a default preset page of the browser, acquires corresponding resources to construct the preset page, and the preset page is different for different browsers and can be set according to actual requirements.
Steps S321-324 are actually adding configurable security monitoring content to the server, so that it is safer to access the website to obtain data according to the web page loading request.
The embodiment provides a webpage output method applied to a server, and provides a process of obtaining a complete webpage file according to webpage loading request rendering from the perspective of the server, wherein the complete webpage file comprises all resources used for rendering a webpage but does not comprise binding to an interaction event, so that a client can render and verify the webpage by itself.
Example four
The fourth embodiment of the present invention provides a web page output apparatus 400, which is installed at a client, and fig. 5 is a schematic structural diagram of the apparatus, as shown in fig. 6, the apparatus includes:
the sending module 410 sends a webpage loading request to the server;
a receiving module 420, configured to obtain a complete webpage file returned by the server according to the webpage loading request, where the complete webpage file is generated by rendering the server according to the webpage loading request;
a page display module 430, configured to display a web page according to the complete web page file;
a rendering module 440, configured to perform page rendering based on the webpage to obtain a client rendering file;
and an interaction binding module 450, configured to perform page interaction event binding based on the web page according to the client rendered file and the complete web page file.
Optionally, in some embodiments, the rendering module includes:
the application construction unit is used for acquiring the JS request script from the complete webpage file so as to construct an application through the JS request script;
and the page rendering unit is used for searching a page component corresponding to the webpage page through the application to perform page rendering, and generating DOM data of elements required by the webpage page in the application.
Optionally, in some embodiments, the complete webpage file includes first DOM data, the client rendered file includes second DOM data, and the interaction binding module includes:
the verification unit is used for verifying whether the first DOM data and the second DOM data are consistent;
the first interaction event binding unit is used for keeping displaying the webpage and selecting the first DOM data or the second DOM data to bind the page interaction event according to a preset rule if the webpage is inconsistent with the first interaction event binding unit;
and the second interaction event binding unit is used for keeping displaying the webpage and optionally binding the page interaction event by the first DOM data or the second DOM data if the webpage is consistent with the second interaction event binding unit.
Optionally, in some embodiments, the verification unit includes:
the node number determining subunit is used for determining the page node number according to the display page and selecting a preset verification algorithm according to the page node number;
and the data verification unit is used for verifying whether the first DOM data and the second DOM data are consistent or not according to the preset verification algorithm.
Optionally, in some embodiments, the first interactivity event binding unit includes:
the selection subunit is used for displaying rendering selection options based on the webpage and acquiring selection operation of a user based on the rendering selection options;
and the binding subunit is used for binding the page interaction event with the corresponding first DOM data or the second DOM data according to the selection operation of the user.
In the webpage output device provided by this embodiment, rendering of a complete webpage is generated and delivered completely to the server, so that the client can quickly perform first screen display according to a complete webpage file, and the client performs one-time page rendering independently to obtain a client rendering file for binding a page interaction event, so that the complete webpage file can be verified, and accurate and error-free webpage output is ensured.
EXAMPLE five
An embodiment of the present invention provides a web page output apparatus 500, which is disposed at a server, and fig. 6 is a schematic structural diagram of the apparatus, and as shown in fig. 6, the apparatus includes:
a loading request receiving module 510, configured to receive a webpage loading request sent by a client;
a complete webpage file generating module 520, configured to construct a webpage according to the webpage loading request, and render the webpage to obtain a complete webpage file;
a file sending module 530, configured to send the complete webpage file to the client.
Optionally, in some embodiments, the complete webpage file generating module includes:
the analysis unit is used for analyzing the access URL of the webpage loading request determining request;
the legal verification unit is used for verifying whether the access URL is legal or not according to preset configuration;
the first page construction unit is used for constructing the webpage oriented by the access URL if the webpage is oriented by the access URL;
and the second page construction unit is used for constructing the preset page if the preset page is not constructed.
The embodiment provides a web page output device applied to a server, which provides a process of obtaining a complete web page file according to a web page loading request from the perspective of the server, wherein the complete web page file contains all resources used for rendering a web page, but does not contain binding to an interaction event, so that a client can render and verify the web page by itself.
EXAMPLE six
Fig. 7 is a schematic structural diagram of an electronic device according to a sixth embodiment of the present invention, as shown in fig. 7, the electronic device includes a processor 610, a memory 620, an input device 630, and an output device 640; the number of the processors 610 in the electronic device may be one or more, and one processor 610 is taken as an example in fig. 7; the processor 610, the memory 620, the input device 630, and the output device 640 in the electronic apparatus may be connected by a bus or other means, and fig. 7 illustrates an example of connection by a bus.
The memory 620, which is a computer-readable storage medium, may be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the web page output method applied to the client in the embodiment of the present invention (e.g., the sending module 410, the receiving module 420, the page display module 430, the rendering module 440, and the interaction binding module 450 in the web page output apparatus). The processor 610 executes various functional applications and data processing of the electronic device by executing software programs, instructions and modules stored in the memory 620, that is, implements the above-described web page output method.
Namely:
sending a webpage loading request to a server;
acquiring a complete webpage file returned by the server according to the webpage loading request, wherein the complete webpage file is generated by rendering the server according to the webpage loading request;
displaying a webpage according to the complete webpage file;
performing page rendering based on the webpage to obtain a client rendering file;
and binding page interaction events based on the webpage according to the client rendering file and the complete webpage file.
Optionally, in some alternative embodiments, the software program, the computer executable program, and the modules stored in the computer readable storage medium, such as the program instructions/modules corresponding to the web page output method applied to the server in the embodiments of the present invention (for example, the loading request receiving module 510, the complete web page file generating module 520, and the file transmitting module 530 in the web page output apparatus). The processor 610 executes various functional applications and data processing of the electronic device by executing the software programs, instructions and modules stored in the memory 620, that is, the above-mentioned web page output method is implemented, that is:
receiving a webpage loading request sent by a client;
constructing a webpage according to the webpage loading request, and rendering the webpage to obtain a complete webpage file;
and sending the complete webpage file to a client.
The memory 420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 420 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 420 may further include memory located remotely from processor 410, which may be connected to an electronic device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input means 430 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device, and may include bluetooth buttons, a microphone, and the like. The output device 440 may include display devices such as indicator lights and display screens, as well as audio devices such as speakers.
EXAMPLE five
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a method for outputting a web page, where the method includes:
sending a webpage loading request to a server;
acquiring a complete webpage file returned by the server according to the webpage loading request, wherein the complete webpage file is generated by rendering the server according to the webpage loading request;
displaying a webpage according to the complete webpage file;
performing page rendering based on the webpage to obtain a client rendering file;
and binding page interaction events based on the webpage according to the client rendering file and the complete webpage file.
In some alternative embodiments, the computer executable instructions, when executed by the computer processor, are for performing another web page output method, comprising:
receiving a webpage loading request sent by a client;
constructing a webpage according to the webpage loading request, and rendering the webpage to obtain a complete webpage file;
and sending the complete webpage file to a client.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the above method operations, and may also perform related operations in the web page output method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, an electronic device, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the apparatus, the included units and modules are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments illustrated herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A webpage output method is applied to a client side and is characterized by comprising the following steps:
sending a webpage loading request to a server;
acquiring a complete webpage file returned by the server according to the webpage loading request, wherein the complete webpage file is generated by rendering the server according to the webpage loading request;
displaying a webpage according to the complete webpage file;
performing page rendering based on the webpage to obtain a client rendering file;
and binding page interaction events based on the webpage according to the client rendering file and the complete webpage file.
2. The method for outputting web pages according to claim 1, wherein the rendering pages based on the web pages to obtain a client rendering file comprises:
acquiring a JS request script from the complete webpage file so as to construct an application through the JS request script;
and searching a page component corresponding to the webpage page through the application to perform page rendering, and generating DOM data of elements required by the webpage page in the application.
3. The method of claim 1, wherein the full webpage file comprises first DOM data, the client rendered file comprises second DOM data, and the binding of page interaction events based on the webpage according to the client rendered file and the full webpage file comprises:
verifying whether the first DOM data and the second DOM data are consistent;
if not, keeping displaying the webpage and selecting the first DOM data or the second DOM data to bind the page interaction event according to a preset rule;
and if so, keeping displaying the webpage and optionally binding the first DOM data or the second DOM data with a page interaction event.
4. The web page output method according to claim 3, wherein the verifying whether the first DOM data and the second DOM data are consistent comprises:
determining the number of page nodes according to the display page, and selecting a preset verification algorithm according to the number of the page nodes;
and verifying whether the first DOM data and the second DOM data are consistent or not according to the preset verification algorithm.
5. The web page output method according to claim 3, wherein the binding of the page interaction event based on the first DOM data or the second DOM data according to the preset rule comprises:
displaying a rendering selection option based on the webpage, and acquiring a selection operation of a user based on the rendering selection option;
and binding the page interaction event with the corresponding first DOM data or the second DOM data according to the selection operation of the user.
6. A webpage output method is applied to a server side and is characterized by comprising the following steps:
receiving a webpage loading request sent by a client;
constructing a webpage according to the webpage loading request, and rendering the webpage to obtain a complete webpage file;
and sending the complete webpage file to a client.
7. The method for outputting web pages according to claim 6, wherein the constructing web pages according to the web page loading request comprises:
analyzing the webpage loading request to determine the access URL of the request;
verifying whether the access URL is legal or not according to preset configuration;
if so, constructing the webpage oriented by the access URL;
if not, a preset page is constructed.
8. A web page output apparatus, comprising:
the sending module is used for sending a webpage loading request to the server;
the receiving module is used for acquiring a complete webpage file returned by the server according to the webpage loading request, wherein the complete webpage file is generated by rendering the server according to the webpage loading request;
the page display module is used for displaying a webpage according to the complete webpage file;
the rendering module is used for performing page rendering on the basis of the webpage to obtain a client rendering file;
and the interactive binding module is used for binding the page interactive events based on the webpage according to the client rendering file and the complete webpage file.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the web page output method of any one of claims 1-7.
10. A computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing the web page output method according to any one of claims 1 to 7.
CN202110767065.9A 2021-07-07 2021-07-07 Webpage output method, device, equipment and storage medium Withdrawn CN113434142A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110767065.9A CN113434142A (en) 2021-07-07 2021-07-07 Webpage output method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110767065.9A CN113434142A (en) 2021-07-07 2021-07-07 Webpage output method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113434142A true CN113434142A (en) 2021-09-24

Family

ID=77759353

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110767065.9A Withdrawn CN113434142A (en) 2021-07-07 2021-07-07 Webpage output method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113434142A (en)

Similar Documents

Publication Publication Date Title
US20150067031A1 (en) Business transaction correlation with client request monitoring data
US8880993B2 (en) Handling unexpected responses to script executing in client-side application
CN107679214B (en) Link positioning method, device, terminal and computer readable storage medium
CN112988599B (en) Page debugging method and device, electronic equipment and storage medium
CN111460356A (en) Automatic login method, device, medium and equipment
JP6877343B2 (en) Handling unstructured messages
EP2959402B1 (en) Architecture for remote access to content state
CN112100536A (en) Webpage access method, device and equipment and readable storage medium
CN104834588A (en) Permanent residence cross site script vulnerability detection method and apparatus
CN112905144A (en) Terminal display method and device, electronic equipment and storage medium
US11614933B2 (en) Disabling a script based on indications of unsuccessful execution of the script
CN110740118B (en) Protocol for initiating sessions with partner sites
CN113296653B (en) Simulation interaction model construction method, interaction method and related equipment
US8332456B2 (en) Displaying server errors on the client machine that caused the failed request
US11115462B2 (en) Distributed system
CN110674435A (en) Page access method, server, terminal, electronic equipment and readable storage medium
CN113434142A (en) Webpage output method, device, equipment and storage medium
US8402367B1 (en) Smart reload pages
CN114915565A (en) Method and system for debugging network
CN111737629B (en) Data detection method and device
CN109756393B (en) Information processing method, system, medium, and computing device
JP2013137631A (en) Reproduction device, reproduction method, and reproduction program
JP4805199B2 (en) Scenario creation program and scenario creation device
CN104423973B (en) Processing method, device and system for floating frame page loading information
US20160179480A1 (en) Computer application development assistance

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20210924

WW01 Invention patent application withdrawn after publication