CN108108367B - Webpage display method and device - Google Patents

Webpage display method and device Download PDF

Info

Publication number
CN108108367B
CN108108367B CN201611050951.5A CN201611050951A CN108108367B CN 108108367 B CN108108367 B CN 108108367B CN 201611050951 A CN201611050951 A CN 201611050951A CN 108108367 B CN108108367 B CN 108108367B
Authority
CN
China
Prior art keywords
display mode
night
web page
webpage
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611050951.5A
Other languages
Chinese (zh)
Other versions
CN108108367A (en
Inventor
应玉龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201611050951.5A priority Critical patent/CN108108367B/en
Publication of CN108108367A publication Critical patent/CN108108367A/en
Application granted granted Critical
Publication of CN108108367B publication Critical patent/CN108108367B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation

Abstract

The embodiment of the invention discloses a webpage display method, which comprises the following steps: analyzing the target webpage data to acquire document object information of the target webpage; determining that the current webpage display mode is a night display mode; acquiring attribute style information corresponding to a night display mode of the target webpage; and rendering and displaying the target webpage according to the document object information of the target webpage and the attribute style information corresponding to the night display mode. The embodiment of the invention also discloses a webpage display device. By adopting the method and the device, the condition that the webpage is abnormally displayed in the night display mode can be effectively avoided.

Description

Webpage display method and device
Technical Field
The invention relates to the technical field of internet, in particular to a webpage display method and device.
Background
Night display mode: the browser has the function of displaying the webpage in a darker color brightness mode; the method mainly aims to solve the problems of bright and dark color contrast, eye fatigue and even eye vision injury caused by strong light of a display screen under a dim light condition. The whole brightness of the displayed webpage after the mode is started is dark, and the problem that a user is tired when browsing the webpage can be relieved.
In the prior art, browsers usually support a night display mode, but display logics of the night display mode of the browsers uniformly adopt display settings built in the browsers to forcibly change display styles of all webpages, so that the situations of unreasonable webpage layout, unreasonable display color brightness and the like are caused, and browsing experience of users is greatly influenced.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for displaying a webpage, which can render and display the webpage according to the night display mode style information set by the webpage itself, so as to effectively avoid the situation that the webpage is displayed abnormally in the night display mode.
In order to solve the above technical problem, an embodiment of the present invention provides a method for displaying a web page, where the method includes:
analyzing the target webpage data to acquire document object information of the target webpage;
determining that the current webpage display mode is a night display mode;
acquiring attribute style information corresponding to a night display mode of the target webpage;
and rendering and displaying the target webpage according to the document object information of the target webpage and the attribute style information corresponding to the night display mode.
Correspondingly, the embodiment of the invention also provides a webpage display device, which comprises:
the document object analysis module is used for analyzing the target webpage data to acquire document object information of the target webpage;
the night mode judging module is used for judging whether the current webpage display mode is the night display mode;
the night mode judging module is used for judging whether the current webpage display mode is the night display mode or not according to the attribute style information corresponding to the night display mode of the target webpage;
and the webpage display module is used for rendering and displaying the target webpage according to the document object information of the target webpage and the attribute style information corresponding to the night display mode.
The web page display device in this embodiment renders and displays the target web page by acquiring the attribute style information corresponding to the night display mode of the target web page and according to the attribute style information corresponding to the night display mode customized for the target web page, and does not render and display all web pages uniformly in the night display mode built in the browser, thereby effectively avoiding the situation that the web page is displayed abnormally in the night display mode.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a web page display method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a technical architecture for obtaining attribute style information corresponding to a night display mode of a target web page in an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a web page display method according to another embodiment of the invention;
FIG. 4 is a schematic structural diagram of a web page display device according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a night mode acquisition module according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a hardware component structure of the web page display device according to the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The web page display method and apparatus in the embodiments of the present invention may be implemented in network devices such as a personal computer, a smart phone, a tablet computer, a notebook computer, an electronic reader, a vehicle-mounted smart device, or a wearable smart device, and may be specifically implemented by a web browser, a web Application client (APP), and the like in the network devices, and when an implementation process of the web page display method is described below, the web page display apparatus is used as an execution subject for explanation.
Fig. 1 is a schematic flowchart of a web page display method in an embodiment of the present invention, where as shown in the flowchart of the web page display method in the embodiment, the web page display method may include:
s101, analyzing the target webpage data to acquire the document object information of the target webpage.
Specifically, the web page display device may determine a currently browsed target web page according to an operation of a user, and further obtain target web page data of the target web page from a web page server (or called a front end server) of the target web page.
In an alternative embodiment, the web page display apparatus may parse the HTML information in the target web page data to obtain document Object information of the target web page, where the document Object information may be DOM (document Object model) information, for example, node information of each node in a DOM tree structure of the target web page, where the node may include a picture node, a text node, or other nodes.
S102, determining that the current webpage display mode is a night display mode.
Specifically, the web page display device may change the current web page display mode according to a setting operation of a user, for example, the user may select a corresponding web page display mode from a preset setting menu of the browser, and set the current web page display mode to a night display mode or a normal (or daytime) mode, optionally, the current web page display device may further include an intelligent night mode, and in the intelligent night mode, the web page display device further needs to detect whether the current ambient brightness reaches a preset threshold, and if the current web page display mode does not reach the preset threshold, the current web page display mode is determined to be the night display mode.
S103, acquiring attribute style information corresponding to the night display mode of the target webpage.
The attribute Style information may include Cascading Style Sheets (CSS) information of the target web page, and may also be display attributes of each web page display element (or node) in the target web page. The attribute style information may include, for example, information of font size, font color, font brightness, web page background color, picture brightness, picture color, and the like.
Referring to the technical architecture diagram shown in fig. 2, the web page display apparatus may obtain the attribute style information corresponding to the night display mode of the target web page through the following three ways:
mode 1), as shown in fig. 2, the web page display apparatus obtains at least two different CSS style information by analyzing the CSS information in the target web page data, where each of the at least two different CSS style information corresponds to a different web page display mode, and further invokes a preset CSS selector to select and load CSS style information corresponding to a night display mode from the at least two CSS style information in the target web page data.
The CSS selector can be triggered and called by a preset night display mode public interface of the webpage display device.
Mode 2), the web page display device loads the attribute style information corresponding to the night display mode of the target web page, which is issued by the web page server of the target web page, through a preset night display mode attribute interface.
Specifically, as shown in fig. 2, the web page display device may obtain the web page script by analyzing web page script information (e.g., JS, JavaScript, an interpreted script programming language) in the target web page data, and then call the night display mode attribute interface by executing the corresponding web page script.
In this way, the web server of the target web page actively issues the attribute style information corresponding to the night display mode of the target web page, and the web page display device immediately or when needed loads the attribute style information corresponding to the night display mode of the target web page issued by the web server of the target web page through the preset attribute interface of the night display mode.
In an optional embodiment of the present invention, the opened and displayed target webpage itself may also sense that the current webpage display mode is the night display mode, for example, a webpage script in the webpage, such as a JavaScript popup, queries whether the current webpage is the night display mode, and confirms that the current webpage is the night display mode after obtaining the confirmation click operation of the JavaScript popup, so as to notify the webpage server of the target webpage through a night display mode public interface preset by the webpage display device, and the webpage server of the target webpage actively issues the attribute style information corresponding to the night display mode of the target webpage.
Mode 3), the web page display device executes a preset night display mode event callback of the target web page, sends a night display mode notification to the web page server of the target web page, and receives attribute style information corresponding to the night display mode of the target web page sent by the web page server of the target web page according to the night display mode notification.
In a specific implementation, as shown in fig. 2, the web page display device obtains the night display mode event callback of the target web page by analyzing the web page script information in the target web page data, and then calls the night display mode event callback by executing the corresponding web page script. The night display mode event callback is a callback function preset by the webpage server of the target webpage, wherein the communication address of the webpage server carrying the target webpage can realize the communication from the webpage display device to the webpage server of the target webpage by executing the night display mode event callback.
In an optional embodiment, after acquiring the night display mode event callback carried in the target web page data, the web page display device may further register the night display mode event callback of the target web page in a preset night display mode public interface, so as to call the night display mode event callback when necessary.
And S104, rendering and displaying the target webpage according to the document object information of the target webpage and the attribute style information corresponding to the night display mode.
As shown in fig. 2, the web page display device renders and displays the target web page according to the parsed DOM information of the target web page and the attribute style information corresponding to the night display mode, for example, renders each web page display element in the DOM tree structure according to the attribute style information corresponding to the night display mode. The attribute style information corresponding to the night display mode may include CSS style information corresponding to the night display mode selected by the CSS selector, or may include attribute style information corresponding to the night display mode of the target web page obtained by the web page display apparatus by executing the web page script parsed from the target web page data.
In addition, the webpage display device can also obtain other webpage script execution results by executing the webpage script analyzed from the target webpage data, so that the webpage display device can render and display the target webpage according to the analyzed DOM information of the target webpage, the attribute style information corresponding to the night display mode and other webpage script execution results.
Therefore, the web page display device in this embodiment renders and displays the target web page by acquiring the attribute style information corresponding to the night display mode of the target web page and according to the attribute style information corresponding to the night display mode customized for the target web page, and does not render and display all web pages uniformly in the night display mode built in the browser, thereby effectively avoiding the situation that the web pages are displayed abnormally in the night display mode.
Fig. 3 is a schematic flowchart of a web page display method in another embodiment of the present invention, in this embodiment, a browser is used as an execution subject to describe an execution process of a web page display method flow, and as shown in the diagram, the web page display method flow in this embodiment may include:
s201, the browser analyzes the target webpage data to acquire the document object information of the target webpage.
S202, the browser determines the current web page display mode, if the current web page display mode is the intelligent night mode, then S203 is executed, if the current web page display mode is the night display mode, then S204 is executed, and if the current web page display mode is the default display mode (or the daytime display mode, the normal display mode), then S205 is executed.
The current webpage display mode is determined by selecting from three different webpage display modes in a mode selection interface provided by the browser in advance by a user, the setting of the webpage display mode can be stored in a browser process registry, and the setting of the webpage display mode which is stored last time can be obtained from the process registry when the browser is started every time, so that the webpage display process is executed according to the different webpage display modes.
S203, the browser detects whether the current ambient brightness reaches a preset threshold, if not, executes S205, and if so, executes S204.
In specific implementation, the browser can call the light sensing module of the terminal to sense the ambient brightness of the surrounding environment, such as a light intensity value or a brightness value, and if the ambient brightness does not reach a preset threshold, it indicates that the current environment is dark, and a night display mode should be adopted to display the target webpage.
And S204, the browser analyzes the target webpage data to judge whether the target webpage is set to a self-defined night display mode, if so, S205 is executed, and otherwise, S206 is executed.
That is, the target web page data may carry indication information for indicating whether the target web page adopts the attribute style information corresponding to the browser-default night display mode, and if the attribute style information corresponding to the browser-default night display mode is not adopted, the target web page data is expressed as the user-defined night display mode.
S205, the browser acquires attribute style information corresponding to the normal mode of the target webpage.
The target web page data carries attribute style information in a normal mode, for example: the font color is black, the background color is white, and the picture and the table frame are black and thick.
S206, the browser acquires attribute style information corresponding to the night display mode of the target webpage.
In the embodiment of the present invention, the background server of the target web page defines the attribute style information in the night display mode for the target web page by user, for example, according to the color that the picture in the target web page is mainly in the gray system, the attribute style information in the night display mode may be set to include: the font color is yellow, the background color is light green, and the picture and the table border are red and bold.
How to obtain the attribute style information corresponding to the night display mode of the target web page is described in detail in the foregoing embodiment S103, and details are not described in this embodiment again.
And S207, the browser acquires attribute style information corresponding to a preset night display mode.
The preset night display mode is a set of general attribute style information which is set in a browser kernel and is adopted for all webpages, and the preset night display mode includes the following steps: the webpage fonts are displayed in black and the background color is gray.
And S208, rendering and displaying the target webpage by the browser according to the document object information of the target webpage and the acquired attribute style information.
Still taking the color of the image in the target webpage mainly in the gray system as an example, if the target webpage is rendered and displayed by adopting the attribute style information corresponding to the night display mode preset by the browser in the night display mode, the font color in the displayed target webpage is black, the webpage background color is dark gray, and meanwhile, the webpage image mainly is also in the gray system, which will not easily distinguish the webpage background and the webpage content image when the user browses the webpage content, and will cause a great influence on browsing experience. In order to avoid the above-mentioned influence caused by the attribute style information of the uniform night display mode of the browser, the web server in the embodiment of the invention defines the attribute style information in the night display mode for the target web page according to the characteristics of the target web page, so that when the browser renders and displays the target web page in the night display mode, the target web page can be rendered and displayed according to the attribute style information corresponding to the night display mode defined by the web server for the target web page, the font color in the displayed target web page is yellow, the background color is light green, and the picture and the form frame are red and thick, thereby enabling a user to easily distinguish different web page contents and web page backgrounds when browsing the web page.
Fig. 4 is a schematic structural diagram of a web page display device in an embodiment of the present invention, where the web page display device in the embodiment at least includes:
and the document object parsing module 410 is configured to parse the target webpage data to obtain document object information of the target webpage.
Specifically, the web page display device may determine a currently browsed target web page according to an operation of a user, and further obtain target web page data of the target web page from a web page server (or called a front end server) of the target web page.
In an alternative embodiment, the document object parsing module 410 may parse the HTML information in the target webpage data to obtain the document object information of the target webpage, where the document object information may be DOM information, for example, node information of each node in a DOM tree structure of the target webpage, where the node may include a picture node, a text node, or other nodes.
The night mode determining module 420 is configured to determine whether the current webpage display mode is the night display mode.
Specifically, the night mode determining module 420 may change the current webpage display mode according to a setting operation of the user, for example, the user may select a corresponding webpage display mode from a preset setting menu of the browser, and set the current webpage display mode to a night mode or a normal (or daytime) mode, optionally, the night mode may further include an intelligent night mode, in the intelligent night mode, the night mode determining module 420 further needs to detect whether the current ambient brightness reaches a preset threshold, and if not, determines that the current webpage display mode is the night display mode.
A night style obtaining module 430, configured to obtain attribute style information corresponding to the night display mode of the target webpage when the night mode determining module determines that the current webpage display mode is the night display mode.
The attribute style information may include CSS information of the target web page, and may also be display attributes of respective web page display elements (or nodes) in the target web page. The attribute style information may include, for example, information of font size, font color, font brightness, web page background color, picture brightness, picture color, and the like.
Referring to the technical architecture diagram shown in fig. 2, the night style obtaining module 430 may obtain the attribute style information corresponding to the night display mode of the target web page by the following three ways:
mode 1), as shown in fig. 2, the night style obtaining module 430 obtains at least two different CSS style information by analyzing the CSS information in the target web page data, where each of the at least two different CSS style information corresponds to a different web page display mode, and further invokes a preset CSS selector to select and load the CSS style information corresponding to the night display mode from the at least two CSS style information in the target web page data.
The CSS selector may be triggered and invoked by the night style obtaining module 430 through a night display mode public interface preset by the web page display apparatus.
Mode 2), the night style obtaining module 430 loads the attribute style information corresponding to the night display mode of the target webpage, which is issued by the webpage server of the target webpage, through a preset night display mode attribute interface.
Specifically, as shown in fig. 2, the web page display device may obtain a web page script by analyzing web page script information in the target web page data, and then call the night display mode attribute interface by executing a corresponding web page script.
In this way, the web server of the target web page actively issues the attribute style information corresponding to the night display mode of the target web page, and the night style acquisition module 430 loads the attribute style information corresponding to the night display mode of the target web page issued by the web server of the target web page immediately or as needed through the preset night display mode attribute interface.
In an optional embodiment of the present invention, the opened and displayed target webpage itself may also sense that the current webpage display mode is the night display mode, for example, a webpage script in the webpage, such as a JavaScript popup, queries whether the current webpage is the night display mode, and confirms that the current webpage is the night display mode after obtaining the confirmation click operation of the JavaScript popup, so as to notify the webpage server of the target webpage through a night display mode public interface preset by the webpage display device, and the webpage server of the target webpage actively issues the attribute style information corresponding to the night display mode of the target webpage.
Mode 3), the night style obtaining module 430 executes a preset night display mode event callback of the target webpage, sends a night display mode notification to the webpage server of the target webpage, and receives attribute style information corresponding to the night display mode of the target webpage, which is sent by the webpage server of the target webpage according to the night display mode notification.
In a specific implementation, as shown in fig. 2, the web page display device obtains the night display mode event callback of the target web page by analyzing the web page script information in the target web page data, and then calls the night display mode event callback by executing the corresponding web page script. The night display mode event callback is a callback function preset by the webpage server of the target webpage, wherein the communication address of the webpage server carrying the target webpage can realize the communication from the webpage display device to the webpage server of the target webpage by executing the night display mode event callback.
In this manner, the night mode acquiring module 430 may further include, as shown in fig. 5:
a night mode notification unit 431, configured to execute a preset night display mode event callback of the target web page, and send a night display mode notification to a web server of the target web page;
a night style receiving unit 432, configured to receive attribute style information corresponding to the night display mode of the target webpage, where the attribute style information is sent by the webpage server of the target webpage according to the night display mode notification.
And the web page display module 440 is configured to render and display the target web page according to the document object information of the target web page and the attribute style information corresponding to the night display mode.
As shown in fig. 2, the web page display module 440 renders and displays the target web page according to the parsed DOM information of the target web page and the attribute style information corresponding to the night display mode, for example, renders each web page display element in the DOM tree structure according to the attribute style information corresponding to the night display mode. The attribute style information corresponding to the night display mode may include CSS style information corresponding to the night display mode selected by the CSS selector, or may include attribute style information corresponding to the night display mode of the target web page obtained by the web page display apparatus by executing the web page script parsed from the target web page data.
In addition, the web page display device may further obtain an execution result of another web page script by executing the web page script parsed from the target web page data, so that the web page display module 440 may render and display the target web page according to the parsed DOM information of the target web page, the attribute style information corresponding to the night display mode, and the execution result of the other web page script.
Further, corresponding to the above mode 3) of obtaining the attribute style information corresponding to the night display mode of the target web page, the web page display apparatus in this optional embodiment may further include:
and the event callback analyzing module 450 is configured to analyze the target webpage data to obtain a night display mode event callback carried in the target webpage data. Specifically, the night display mode event callback of the target webpage can be obtained by analyzing webpage script information in the target webpage data.
And an event callback registering module 460, configured to register a night display mode event callback of the target webpage. Specifically, the night display mode event callback of the target webpage may be registered in a preset night display mode public interface, so that the night display mode event callback may be called later when needed.
Further in an optional embodiment, the web page display apparatus may further include:
and a custom judging module, configured to analyze target webpage data to judge whether the target webpage is set to a custom night display mode, if so, notify the night style obtaining module 430 to obtain attribute style information corresponding to the night display mode of the target webpage, otherwise, notify the night style obtaining module 430 to obtain attribute style information corresponding to a preset night display mode of the browser.
In a specific implementation, the target webpage data may carry indication information for indicating whether the target webpage adopts the attribute style information corresponding to the browser-default night display mode, and if the attribute style information corresponding to the browser-default night display mode is not adopted, the target webpage data is expressed as the user-defined night display mode.
Therefore, the web page display device in this embodiment renders and displays the target web page by acquiring the attribute style information corresponding to the night display mode of the target web page and according to the attribute style information corresponding to the night display mode customized for the target web page, and does not render and display all web pages uniformly in the night display mode built in the browser, thereby effectively avoiding the situation that the web pages are displayed abnormally in the night display mode.
It should be noted that the web page display device may be an electronic device such as a PC, and may also be a portable electronic device such as a PAD, a tablet computer, and a laptop computer, which is not limited to the description herein; the web page display device may include at least a database for storing data and a processor for data processing, and may include a built-in storage medium or an independently provided storage medium.
As for the processor for data Processing, when executing Processing, the processor can be implemented by a microprocessor, a Central Processing Unit (CPU), a Digital Signal Processor (DSP), or a Programmable logic Array (FPGA); for the storage medium, the storage medium contains operation instructions, which may be computer executable codes, and the operation instructions implement the steps in the web page display flow shown in fig. 1 to 3 according to the embodiment of the present invention.
Fig. 6 shows an example of a web page display device as a hardware entity. The apparatus comprises a processor 601, a storage medium 602, and at least one external communication interface 603; the processor 601, storage medium 602, and communication interface 603 are all connected by a bus 604.
The processor 601 in the web page display apparatus may call the operation instructions in the storage medium 602 to execute the following flow:
analyzing the target webpage data to acquire document object information of the target webpage;
determining that the current webpage display mode is a night display mode;
acquiring attribute style information corresponding to a night display mode of the target webpage;
and rendering and displaying the target webpage according to the document object information of the target webpage and the attribute style information corresponding to the night display mode.
Here, it should be noted that: the above description related to the web page display device is similar to the foregoing description of the web page display method, and the description of the beneficial effects of the same method is omitted for brevity. For technical details not disclosed in the embodiment of the web page display device of the present invention, please refer to the description of the embodiment of the method of the present invention.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Alternatively, the integrated unit of the present invention may be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or a part contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic or optical disk, or various other media that can store program code.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (15)

1. A method for displaying a web page, the method comprising:
analyzing the target webpage data to acquire document object information of the target webpage;
determining that the current webpage display mode is a night display mode;
acquiring attribute style information corresponding to a night display mode which is customized by a webpage server corresponding to the target webpage aiming at the target webpage;
and rendering and displaying the target webpage according to the document object information of the target webpage and the attribute style information corresponding to the night display mode.
2. The web page display method of claim 1, wherein the target web page data includes at least two different attribute style information;
the acquiring the night display mode style information of the target webpage comprises the following steps:
and calling a preset style information selector, and selecting and loading the attribute style information corresponding to the night display mode from at least two kinds of attribute style information in the target webpage data.
3. The method for displaying web pages according to claim 1, wherein the obtaining of the attribute style information corresponding to the night display mode of the target web page comprises:
and loading attribute style information corresponding to the night display mode of the target webpage, which is issued by the webpage server of the target webpage, through a preset night display mode attribute interface.
4. The method for displaying web pages according to claim 1, wherein the obtaining of the attribute style information corresponding to the night display mode of the target web page comprises:
executing a preset night display mode event call-back of the target webpage, and sending a night display mode notification to a webpage server of the target webpage;
and the web server receiving the target web page sends attribute style information corresponding to the night display mode of the target web page according to the night display mode notification.
5. The method for displaying web pages according to claim 4, wherein before the executing the preset night display mode event callback of the target web page, the method further comprises:
analyzing the target webpage data to acquire a night display mode event callback carried in the target webpage data;
and registering a night display mode event callback of the target webpage.
6. The method of displaying a web page according to claim 1, wherein the determining that the current web page display mode is the night display mode comprises:
and detecting whether the current ambient brightness reaches a preset threshold value, and if not, determining that the current webpage display mode is a night display mode.
7. The method for displaying web pages according to any one of claims 1 to 6, further comprising, after determining that the current web page display mode is the night display mode and before acquiring the attribute style information corresponding to the night display mode of the target web page:
analyzing the target webpage data to judge whether the target webpage is set to a self-defined night display mode, if so, acquiring attribute style information corresponding to the night display mode of the target webpage, and otherwise, acquiring attribute style information corresponding to the night display mode preset by the browser.
8. A web page display apparatus, characterized in that the web page display apparatus comprises:
the document object analysis module is used for analyzing the target webpage data to acquire document object information of the target webpage;
the night mode judging module is used for judging whether the current webpage display mode is the night display mode;
the night mode obtaining module is used for obtaining attribute mode information corresponding to the target webpage and aiming at the target webpage, wherein the attribute mode information corresponds to the night display mode defined by the webpage server corresponding to the target webpage when the night mode judging module determines that the current webpage display mode is the night display mode;
and the webpage display module is used for rendering and displaying the target webpage according to the document object information of the target webpage and the attribute style information corresponding to the night display mode.
9. The web page display apparatus of claim 8, wherein the target web page data includes at least two different attribute style information;
the night pattern acquisition module is configured to: and calling a preset style information selector, and selecting and loading the attribute style information corresponding to the night display mode from at least two kinds of attribute style information in the target webpage data.
10. The web page display apparatus of claim 8, wherein the night style acquisition module is configured to: and loading attribute style information corresponding to the night display mode of the target webpage, which is issued by the webpage server of the target webpage, through a preset night display mode attribute interface.
11. The web page display apparatus of claim 8, wherein the night style acquisition module comprises:
the night mode notification unit is used for executing a preset night display mode event callback of the target webpage and sending a night display mode notification to a webpage server of the target webpage;
and the night style receiving unit is used for receiving the attribute style information corresponding to the night display mode of the target webpage, which is sent by the webpage server of the target webpage according to the night display mode notification.
12. The web page display apparatus of claim 11, further comprising:
the event callback analysis module is used for analyzing the target webpage data to acquire night display mode event callbacks carried in the target webpage data;
and the event callback registration module is used for registering the night display mode event callback of the target webpage.
13. The web page display apparatus according to claim 8, wherein the night mode determination module is configured to:
and detecting whether the current ambient brightness reaches a preset threshold value, and if not, determining that the current webpage display mode is a night display mode.
14. The web page display apparatus according to any one of claims 8 to 13, further comprising:
and the custom judging module is used for analyzing the target webpage data to judge whether the target webpage is set to a custom night display mode, if so, informing the night style acquiring module to acquire the attribute style information corresponding to the night display mode of the target webpage, and otherwise, informing the night style acquiring module to acquire the attribute style information corresponding to the preset night display mode of the browser.
15. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-7.
CN201611050951.5A 2016-11-24 2016-11-24 Webpage display method and device Active CN108108367B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611050951.5A CN108108367B (en) 2016-11-24 2016-11-24 Webpage display method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611050951.5A CN108108367B (en) 2016-11-24 2016-11-24 Webpage display method and device

Publications (2)

Publication Number Publication Date
CN108108367A CN108108367A (en) 2018-06-01
CN108108367B true CN108108367B (en) 2021-10-26

Family

ID=62204967

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611050951.5A Active CN108108367B (en) 2016-11-24 2016-11-24 Webpage display method and device

Country Status (1)

Country Link
CN (1) CN108108367B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111125587B (en) * 2019-12-31 2023-08-04 北京百度网讯科技有限公司 Webpage structure optimization method, device, equipment and storage medium
CN111367606A (en) * 2020-03-03 2020-07-03 北京奇艺世纪科技有限公司 Application page display method, device, terminal and medium
CN112507385B (en) * 2020-12-25 2022-05-10 北京字跳网络技术有限公司 Information display method and device and electronic equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2653162C (en) * 2008-02-14 2014-02-04 Research In Motion Limited A method, server and system for optimizing html-based content
US8874637B2 (en) * 2001-04-09 2014-10-28 Mercury Kingdom Assets Limited Server-based browser system
CN104346403A (en) * 2013-08-07 2015-02-11 腾讯科技(深圳)有限公司 Browser page display method and device as well as browser and terminal
CN104462312A (en) * 2014-11-28 2015-03-25 北京奇虎科技有限公司 Web page displaying method and browser client side
CN104731815A (en) * 2013-12-23 2015-06-24 腾讯科技(深圳)有限公司 Webpage element drawing method and device
CN105786924A (en) * 2014-12-25 2016-07-20 广州市动景计算机科技有限公司 Webpage night mode processing method and apparatus, and mobile terminal
CN105979392A (en) * 2015-09-14 2016-09-28 乐视致新电子科技(天津)有限公司 Webpage display method and browser
CN105989069A (en) * 2015-02-10 2016-10-05 中国移动通信集团云南有限公司 Webpage adaptive adjustment method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI280526B (en) * 2005-03-18 2007-05-01 Mitac Int Corp Method of automatically switching displaying mode of navigation map
CN102662672B (en) * 2012-04-05 2015-04-29 广州市动景计算机科技有限公司 Method and device for conducting skin changing process to webpages as well as mobile terminal
CN104063460B (en) * 2014-06-25 2018-10-09 北京奇虎科技有限公司 A kind of method and apparatus loading webpage in a browser

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8874637B2 (en) * 2001-04-09 2014-10-28 Mercury Kingdom Assets Limited Server-based browser system
CA2653162C (en) * 2008-02-14 2014-02-04 Research In Motion Limited A method, server and system for optimizing html-based content
CN104346403A (en) * 2013-08-07 2015-02-11 腾讯科技(深圳)有限公司 Browser page display method and device as well as browser and terminal
CN104731815A (en) * 2013-12-23 2015-06-24 腾讯科技(深圳)有限公司 Webpage element drawing method and device
CN104462312A (en) * 2014-11-28 2015-03-25 北京奇虎科技有限公司 Web page displaying method and browser client side
CN105786924A (en) * 2014-12-25 2016-07-20 广州市动景计算机科技有限公司 Webpage night mode processing method and apparatus, and mobile terminal
CN105989069A (en) * 2015-02-10 2016-10-05 中国移动通信集团云南有限公司 Webpage adaptive adjustment method and device
CN105979392A (en) * 2015-09-14 2016-09-28 乐视致新电子科技(天津)有限公司 Webpage display method and browser

Also Published As

Publication number Publication date
CN108108367A (en) 2018-06-01

Similar Documents

Publication Publication Date Title
TWI690812B (en) Method, device and client for dynamic layout of page elements
US10409899B2 (en) Method, device and mobile terminal for processing webpage in night mode
CN106708496B (en) Processing method and device for label page in graphical interface
CN108108367B (en) Webpage display method and device
WO2014026606A1 (en) Method, system and device for filtering mobile terminal webpage advertisements
US20150286743A1 (en) Method, system, and device for marking web content
CN111259284A (en) Page lazy loading method and device, storage medium and processor
CN107045546B (en) Webpage processing method and device and intelligent terminal
CN104731815B (en) A kind of method for drafting and device of web page element
CN114218890A (en) Page rendering method and device, electronic equipment and storage medium
WO2022223002A1 (en) Page display method and apparatus, and electronic device
CN108874373B (en) Method and device for inserting information into webpage, display terminal and storage medium
CN111782324A (en) Application interface jumping method, device, equipment and computer readable storage medium
CN105022734B (en) background color setting method and device
CN108268298B (en) Desktop icon generation method and device, storage medium and electronic equipment
CN108415746B (en) Application interface display method and device, storage medium and electronic equipment
CN106708591B (en) Character detection method and device for operating system
CN105573705A (en) Display control method and terminal
CN106201185B (en) Method and device for positioning input box in browser and mobile device
CN108228284B (en) Window display method and terminal
CN106570034B (en) Advertisement filtering method, server and client
CN111124568A (en) Fast application night mode starting method and device, electronic equipment and storage medium
CN112261227A (en) Method for multi-screen equal-proportion adaptation of mobile terminal
CN111899042A (en) Malicious exposure advertisement behavior detection method and device, storage medium and terminal
KR20190106044A (en) Method for displaying web page and electronic device

Legal Events

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