The present invention relates to the technical field of webpage display, and in particular, to a method, and a device for displaying a first screen of a webpage.
With the advent of the 4G era, accessing the Internet for information by mobile phone browsers becomes a mainstream way. The advantage of using the mobile phone browser is that people can use pieces of time to browse Internet pages at any time and any place. This advantage can be achieved by the increase of the speed of mobile networks, and the enhancement of the performance of the mobile hardware. It also requires a higher display speed of the webpage on the mobile phone. According to statistics, the time to open a webpage that satisfies users most is equal to or less than 2 seconds; users can endure about 6 to 8 seconds to open a large webpage; and most users will give up access the webpage if the webpage open time is more than 8 seconds.
In a mobile browser, users may be mainly concerned about two time points of a webpage display. The first time point is for a first webpage display. At this time point, only a small portion of the content of a webpage, such as title text of the webpage, is displayed. The second time point is for a full content display as the webpage is filled in the entire screen for the first time and the second time point is also referred as an open time of a first screen. The open time of the first screen that satisfies users is equal to or less than 2 seconds usually. Thus, if the mobile browser can speed up page display of the first screen, a better experience may be brought to users.
Therefore, improved techniques for accelerating display of a webpage are desired to enhance users' experience.
Exemplary embodiments of the present invention that are shown in the drawings are summarized below. These and other embodiments are more fully described in the Detailed Description section. It is to be understood, however, that there is no intention to limit the invention to the forms described in this Summary of the Invention or in the Detailed Description. One skilled in the art can recognize that there are numerous modifications, equivalents and alternative constructions that fall within the spirit and scope of the invention as expressed in the claims.
In general, the present invention is directed to a method, and a device for displaying a first screen of a webpage without any delay.
According to one aspect of the present invention, a method of displaying a webpage is provided, and the method comprises: parsing a plurality of elements of a webpage successively until recognizing a first screen element, which is defined for a first screen of the webpage; and displaying the first screen of the webpage based on the plurality of elements previously parsed.
According to another aspect of the present invention, a device of displaying a webpage is provided, and the device comprises: a layout engine configured for parsing a plurality of elements of a webpage successively until recognizing a first screen element, which is defined for a first screen of the webpage; and a displaying module configured for displaying the first screen of the webpage based on the plurality of elements previously parsed.
One of the features, benefits and advantages in the present invention is to provide techniques for displaying the first screen of the webpage timely to shorten the display time of the first screen.
Other objects, features, and advantages of the present invention will become apparent upon examining the following detailed description of an embodiment thereof, taken in conjunction with the attached drawings.
Various objects and advantages and a more complete understanding of the present invention are apparent and more readily appreciated by referring to the following detailed description and to the appended claims when taken in conjunction with the accompanying drawings:
The detailed description of the present invention is presented largely in terms of procedures, steps, logic blocks, processing, or other symbolic representations that directly or indirectly resemble the operations of devices or systems contemplated in the present invention. These descriptions and representations are typically used by those skilled in the art to most effectively convey the substance of their work to others skilled in the art.
While the present invention is described herein with references to illustrative embodiments for particular applications, it should be understood that the invention is not limited thereto. Those skilled in the art with access to the teachings herein will recognize additional modifications, applications, and embodiments within the scope thereof and additional fields in which the invention would be of significant utility.
Embodiments of the present invention are disclosed herein with reference to
In one embodiment, the browser 124 is designed to perform a set of functions that are to be described further herein. The browser 124 may be implemented in software according to one embodiment of the present invention. A general portable device would not perform the functions or results desired in the present invention unless it is installed with the browser which is driven in a way specified herein.
The webpage is designed and uploaded onto the web server 106 in advance. The webpage is displayed by a plurality of elements (Html elements). In order to display a first screen of the webpage quickly, the first screen of the webpage merely includes a part of the elements of the webpage that can fill with the display screen for the first time. A webpage developer may be used for marking one element referred as a first screen element, which is defined for the first screen of the webpage by a developer tool such as Chrome's Developer Tools.
At the step 320, the layout engine 1241 parses a plurality of elements of the webpage. Then, the method 300 goes to the step 330, where whether the parsed element is the first screen element is determined. If the parsed element is not the first screen element, the method 300 returns to the step 320 to continue parsing the elements of the webpage. If the parsed element is the first screen element, the method 300 goes to the step 340, where the display module 1242 displays the first screen of the webpage based on the plurality of elements previously parsed. Thus, the first screen is displayed without any delay.
At the step 350, the layout engine 1241 continues to parse the first screen element and the rest of the elements of the webpage successively.
At the step 360, the display module 1242 further displays a complete webpage based on the parsed elements of the webpage.
As described above, the layout engine 1241 parses the elements of the webpage successively until the first screen element is recognized. The display module 1242 displays the first screen of the webpage based on the plurality of elements previously parsed timely once the first screen element is obtained. In other words, the layout engine 1241 stops parsing and rendering the element of the webpage to display the first screen of the webpage when the first screen element is obtained. Because the webpage developer may select a suitable element as the first screen element for the screen-size of the client device used to display the webpage, the browser may parse the elements of the webpage successively and proceed to display the first screen at a satisfying first time point. Thus, the display time of the first screen is shortened in the present invention.
The first screen element is determined through a mark which is set during developing the webpage by the webpage developer.
In the first embodiment, only one element is marked as the first screen element according to a fixed screen-size of the client device used to display the webpage. Namely, the mark is configured to define one first screen element. Depending on implementation, the mark is set as a CSS (Cascading Style Sheet) attribute which includes a syntax element referred as “first screen paint” and directly marks one element as the first screen element inner/outer linked in the element. The CSS attribute is obtained during parsing the plurality of elements of the webpage. If the “first screen paint” of the parsed element is equal to “YES”, the parsed element is determined to be the first screen element; otherwise, the parsed element is determined not to be the first screen element.
However, the conventional client devices such as mobile phones have multiple screen-sizes, such as 4-inch screen, 5-inch screen, 5.5-inch screen etc., and the areas of the first screens for the mobile devices with different screen sizes are different. For better display effect, the first screen element should be changed with the screen-size of the client device used to display the webpage. In the second embodiment, a plurality of elements of the webpage are marked as the first screen elements according to multiple screen-sizes of the client device. Namely, the mark is configured to define one first screen element to adapt multiple screen-sizes of the client device. Depending on implementation, the mark is set as a CSS media query which may be configured into a header of the webpage including a syntax element referred as “first screen paint” to define IDs (Identifier) of the plurality of first screen elements. The CSS media query is obtained during parsing the header of the webpage.
After the IDs of the first screen elements are obtained during parsing the header of the webpage, one ID of the first screen elements suitable for a client device used to display the webpage is selected according to the screen-size of the device used to display the webpage. Then, the ID of the parsed element is compared with the ID of the selected first screen element. If yes, the parsed element is determined to be the first screen element; otherwise, the parsed element is determined not to be the first screen element. Because one of the first screen elements of the webpage most suitable for the screen-size of the client device using to display the webpage is selected, all the client devices with different screen-sizes can display the first screen of the webpage quickly.
Referring to
For example, the following web code will be added into the CSS media queries of the webpage in order to display of the first screen of the webpage quickly:
The present invention has been described in sufficient details with a certain degree of particularity. It is understood to those skilled in the art that the present disclosure of embodiments has been made by way of examples only and that numerous changes in the arrangement and combination of parts may be resorted without departing from the spirit and scope of the invention as claimed. Accordingly, the scope of the present invention is defined by the appended claims rather than the foregoing description of embodiments.
This application is a continuation application of International Application No. PCT/CN2015/076974, filed on Apr. 20, 2015, the entire content of which is incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2015/076974 | Apr 2015 | US |
Child | 15442455 | US |