CN115186207A - Method and device for loading page resources and electronic equipment - Google Patents

Method and device for loading page resources and electronic equipment Download PDF

Info

Publication number
CN115186207A
CN115186207A CN202210687864.XA CN202210687864A CN115186207A CN 115186207 A CN115186207 A CN 115186207A CN 202210687864 A CN202210687864 A CN 202210687864A CN 115186207 A CN115186207 A CN 115186207A
Authority
CN
China
Prior art keywords
page elements
target
resource information
page
information corresponding
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.)
Pending
Application number
CN202210687864.XA
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.)
Shanghai Ruijia Information Technology Co ltd
Original Assignee
Shanghai Ruijia Information Technology 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 Shanghai Ruijia Information Technology Co ltd filed Critical Shanghai Ruijia Information Technology Co ltd
Priority to CN202210687864.XA priority Critical patent/CN115186207A/en
Publication of CN115186207A publication Critical patent/CN115186207A/en
Pending legal-status Critical Current

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
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • 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
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a method and a device for loading page resources and electronic equipment, wherein the method comprises the following steps: under the condition of loading the target page, acquiring resource information corresponding to a first number of page elements in the target page; loading resource information corresponding to the first number of page elements; and displaying the resource information corresponding to the second number of page elements in the first number of page elements. And displaying the resource information corresponding to all or part of the first target page elements under the condition of receiving the first target input of the user. According to the embodiment of the invention, all the acquired resource information is loaded to the target page when the resource information is loaded for the first time, so that the process of loading the resource information can be saved when the remaining resource information needs to be displayed, the waiting time of a user is shortened, and the use experience of the user is improved.

Description

Method and device for loading page resources and electronic equipment
Technical Field
The present invention relates to the field of network technologies, and in particular, to a method and an apparatus for loading a page resource, and an electronic device.
Background
Under the background of the era of rapid development of the internet, people can access resource information in the internet only by using terminal equipment, and can not finish various things in work and life. Usually, resource information in the internet is loaded into pages, and the resource information is displayed to people in the form of pages. With the continuous development of internet technology, the requirements of people on use experience are also continuously improved. In the user experience, the waiting time of the user occupies a very important position. At present, user waiting mainly comprises two stages, wherein the first stage is that when a page is opened for the first time, the user waits for page initialization and loads data for the first time; the second stage is that when the page has loaded and displayed part of the data content, the user waits for the current page to load and display the remaining page data in the case that the remaining data content needs to be viewed.
Currently, for the second phase of user waiting, a preloading technology is usually adopted to shorten the waiting time of the user. Namely, in the process of accessing the page by the user, the resource information which is possibly accessed in the current page and is not displayed is downloaded to the local in advance. When the user needs to access the resource information, the resource information is acquired from the local, loaded and displayed, and the resource information does not need to be acquired from the server again, so that the waiting time of the user in the second stage is shortened.
However, in the second phase, it is necessary to display the resource information that has not been accessed by the user to the user. With the increasing space occupied by the resource information, even if the preloading technology is used, it still takes a long time to load the resource information occupying a large space, so that the user still needs to wait for a long time to view the resource information in the second stage.
Disclosure of Invention
In view of the above problems, embodiments of the present invention are proposed to provide a method and an apparatus for loading page resources, and an electronic device, which overcome the above problems or at least partially solve the above problems.
In a first aspect, an embodiment of the present invention provides a method for loading a page resource, where the method includes:
under the condition of loading a target page, acquiring resource information corresponding to a first number of page elements in the target page;
loading the resource information corresponding to the first number of page elements;
displaying resource information corresponding to a second number of page elements in the first number of page elements, wherein the numerical value of the second number is smaller than the numerical value of the first number;
and under the condition that first target input of a user is received, displaying resource information corresponding to all or part of first target page elements, wherein the first target page elements are page elements which do not display the resource information in the first number of page elements.
Optionally, in a case that resource information corresponding to all or part of the first target page element is displayed, the method further includes:
monitoring the number of the first target page elements;
acquiring resource information corresponding to a third number of page elements when the number of the first target page elements is less than or equal to a first target number, wherein the third number of page elements comprises part or all of all page elements of the target page except the first number of page elements;
loading the resource information corresponding to the third number of page elements;
and displaying part or all of the resource information corresponding to the second target page elements when second target input of a user on the target page is received and the number of the first target page elements is less than a preset number, wherein the second target page elements are page elements which do not display the resource information in the third number of page elements.
Optionally, the displaying resource information corresponding to each of a second number of page elements in the first number of page elements includes:
selecting a second number of page elements from the first number of page elements according to a first target policy;
adjusting the attribute values of the target attributes of the second number of page elements to the first attribute values for displaying the page elements;
and adjusting the attribute values of the target attributes of the remaining page elements to be second attribute values for hiding the page elements, wherein the remaining page elements are page elements except the second number of page elements in the first number of page elements.
Optionally, the resource information corresponding to the first target page element of the display part includes:
selecting a part of first target page elements from all the first target page elements according to a second target strategy;
and adjusting the attribute values of the target attributes of the partial first target page elements to be first attribute values for displaying the page elements, and adjusting the attribute values of the target attributes of the rest page elements in the first target page elements to be second attribute values for hiding the page elements.
Optionally, the first number of page elements are page elements formed by hypertext markup language tags of the same type and/or page elements whose corresponding resource information is greater than or equal to a preset value.
Optionally, the same type of hypertext markup language tag comprises an inline frame (iframe) tag.
In a second aspect, an embodiment of the present invention further provides an apparatus for loading a page resource, where the apparatus includes:
the first acquisition module is used for acquiring resource information corresponding to a first number of page elements in a target page under the condition of loading the target page;
a first loading module, configured to load resource information corresponding to each of the first number of page elements;
a first display module, configured to display resource information corresponding to a second number of page elements in the first number of page elements, where a numerical value of the second number is smaller than a numerical value of the first number;
and a second display module, configured to display resource information corresponding to all or part of the first target page elements when a first target input of a user is received, where the first target page element is a page element, in the first number of page elements, for which the resource information is not displayed.
Optionally, the apparatus further comprises:
the monitoring module is used for monitoring the number of the first target page elements under the condition of displaying all or part of resource information corresponding to the first target page elements;
a second obtaining module, configured to obtain resource information corresponding to a third number of page elements when the number of the first target page elements is less than or equal to a first target number, where the third number of page elements includes some or all of all page elements of the target page, except for the first number of page elements;
a second loading module, configured to load resource information corresponding to each of the third number of page elements;
and the third display module is used for displaying part or all of the resource information corresponding to the second target page elements when second target input of a user on the target page is received and the number of the first target page elements is less than a preset number, wherein the second target page elements are page elements which do not display the resource information in the third number of page elements.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements, when executing the computer program, the steps in the method for loading page resources as described above.
In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the method for loading page resources as described in the first aspect.
In the embodiment of the invention, under the condition of loading the target page, the resource information corresponding to the first number of page elements in the target page is obtained, so that the resource information required to be displayed in the target page is obtained. And then loading all the obtained resource information which needs to be displayed in the target page into the target page, and displaying part of the resource information which needs to be displayed in the target page. Therefore, after the first target input of the user is received, the resource information which is loaded to the target page and is not displayed is directly shown. Compared with the preloading technology, the embodiment of the invention loads all the acquired resource information to the target page when the resource information is loaded for the first time, so that the process of loading the resource information can be saved and the loaded resource information can be directly displayed when the residual resource information needs to be displayed. Especially, the resource information occupying a large space can be rapidly displayed, so that the waiting time of a user is shortened, and the use experience of the user is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a flowchart illustrating steps of a method for loading page resources according to an embodiment of the present invention;
fig. 2 is a schematic diagram of an actual application of the method for loading page resources according to the embodiment of the present invention;
fig. 3 is a block diagram of a structure of an apparatus for loading page resources according to an embodiment of the present invention;
fig. 4 is a block diagram of an electronic device according to an 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 some, but not all, embodiments of the present invention. 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.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
In various embodiments of the present invention, it should be understood that the sequence numbers of the following processes do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Referring to fig. 1, an embodiment of the present invention provides a method for loading a page resource, where the method includes:
step 101: and under the condition of loading the target page, acquiring resource information corresponding to the first number of page elements in the target page.
It should be noted that the case of loading the target page may be understood as a case of loading the page after the page jump is triggered by the user or automatically triggered, and the page after the jump is the target page. Of course, the application home page may be loaded after the application is started, and the application home page is the target page. It can be understood that in the development process of the target page, different page elements are generally required to be written to load different resource information, so that the different resource information is displayed in the target page.
Specifically, the target page may be any page of an application installed in a terminal device such as a mobile phone or a computer. For example, the target page may be a Web page (Web page), which is a Web page loaded in a common browser, but is not limited thereto. The target page may also be other types of pages in the application. When the target page is a Web page, the page elements are elements formed by HTML (HyperText Markup Language) tags, where the elements formed by the HTML tags may be: here, < imgsrc = "/i/eg _ tip.jpg" alt = "hong kong-tulip"/>, the < img > tag is merely used as an example, and the tag is not limited to the < img > tag, and may be any HTML tag. Correspondingly, the picture indicated by "/i/eg _ tip.jpg" is one of the resource information corresponding to the page element.
The first number of page elements may be all page elements in the target page or may be part of page elements in the target page. Here, the specific value of the first number may be set according to the display requirement of the target page. For example, the target page includes 10 page elements, if the display requirement is that only 5 page elements need to be displayed, the first number is set to 5, and under the condition that the target page is loaded, the resource information corresponding to each of the 5 page elements is obtained.
Step 102: and loading the resource information corresponding to the first number of page elements.
It should be noted that, in the process of displaying the page, the resource information needs to be rendered to the page first, and then further processed in a very short time, so that the resource information rendered to the page is displayed in the page. Therefore, loading the resource information corresponding to the page element may be understood as rendering the resource information corresponding to the page element to the destination page. Here, it is necessary to load all the resource information corresponding to all the page elements in the acquired target page to the target page.
Step 103: and displaying the resource information corresponding to the second number of page elements in the first number of page elements.
It should be noted that the first number, the second number are all greater than zero, and the value of the second number is less than the value of the first number. That is, only the resource information corresponding to some of the first number of page elements is shown, and the resource information corresponding to the page elements other than the second number of page elements in the first number of page elements is in a hidden state. For example, the resource information corresponding to the first number of page elements is 10 pictures, the resource information corresponding to the second number of page elements is a part of the 10 pictures, if each picture has a number and starts from 0 to 9, the 10 pictures starting from 0 to 9 are all loaded to the target page during loading, only the picture with the number 0 can be displayed during displaying, and the 9 pictures starting from 1 to 9 are set in a hidden state, so that the user can only see the picture with the number 0 when viewing the target page. The second number may be determined based on a specific value of the first number, and the value of the second number is a smaller value in the case that the value of the second number is guaranteed to be smaller than the value of the first number, for example, the value of the second number may be 1, but is not limited thereto.
It can be understood that, in some scenarios, hardware resources can be reasonably saved by displaying the partially loaded resource information, for example, in the process of searching for the same type of pictures, the resource information of the first number of page elements in the search result interface is 10 pictures, at this time, since 10 pictures are the same type of pictures, the user may meet the requirement for the type of pictures only by viewing a part of the pictures, at this time, the resource information of the second number of page elements may be two of the 10 pictures, and only two pictures are displayed for the user to view.
Step 104: and under the condition that the first target input of the user is received, displaying the resource information corresponding to all or part of the first target page elements.
It should be noted that the first target input includes, but is not limited to, a click, a slide, a long press, and the like input. Since the second number is smaller than the first number, when the resource information is displayed for the first time in step 103, only a part of the resource information that has been loaded into the resource information of the destination page is displayed. Therefore, after receiving the first target input, the resource information that has been loaded to the target page but has not been displayed, that is, the resource information corresponding to the first target page element, is displayed. The first target page element is a page element which does not display the resource information in the first number of page elements. It is understood that, each time the first target input of the user is received, the resource information corresponding to the first target page element is displayed once, and the number of the first target page elements for which the resource information is displayed each time may be the same or different. Preferably, the number of first target page elements for which resource information is displayed at a time may be related to the number of all first target page elements. Here, a first threshold number may be set, the first threshold number may be a second number or another value, and in a case where the number of all the first target page elements is greater than or equal to the first threshold number, the number of the first target page elements for which the resource information is displayed each time is equal to the first threshold number, that is, the resource information corresponding to a part of the first target page elements is displayed. And under the condition that the number of all the first target page elements is smaller than the first threshold number, displaying the resource information corresponding to all the first target page elements.
The first target input by the user is received for the first time after step 103, the number of the first target page elements may be one or more. And displaying the resource information corresponding to all the first target page elements under the condition that the number of the first target page elements is one. And displaying all or part of the resource information corresponding to the first target page element under the condition that the number of the first target page elements is multiple. The resource information corresponding to the displayed part of the first target page element can be understood as selecting part of the first target page element, and only the resource information corresponding to the selected first target page element is displayed.
In the embodiment of the invention, under the condition of loading the target page, the resource information corresponding to the first number of page elements in the target page is obtained, so that the resource information required to be displayed in the target page is obtained. And then loading all the obtained resource information which needs to be displayed in the target page into the target page, and displaying part of the resource information which needs to be displayed in the target page. Therefore, after the first target input of the user is received, the resource information which is loaded to the target page and is not displayed is directly shown. Compared with the preloading technology, the embodiment of the invention loads all the acquired resource information to the target page when the resource information is loaded for the first time, so that the process of loading the resource information can be saved and the loaded resource information can be directly displayed when the remaining resource information needs to be displayed. Especially, the resource information occupying a larger space can be quickly displayed, so that the waiting time of a user is shortened, and the use experience of the user is improved.
Optionally, in the case that resource information corresponding to all or part of the first target page element is displayed, the method further includes:
the number of first target page elements is monitored.
It should be noted that the first target page element is a page element that has not displayed resource information among the first number of page elements to which resource information has been loaded. As the user continues to perform the first target input, more and more resource information corresponding to the first target page elements are displayed. Thus, the number of first target page elements will gradually decrease. For example, the number of the current first target page elements is 6, and when the first target input of the user is received, the resource information of 2 first target page elements of the 6 first target page elements is displayed, and at this time, it may be monitored that the number of the first target page elements is reduced to 4. Specifically, after resource information corresponding to a first target page element is displayed each time in response to a first target input of a user, the number of the first target page element is monitored.
And under the condition that the number of the first target page elements is less than or equal to the first target number, acquiring resource information corresponding to a third number of page elements, wherein the third number of page elements comprise part or all of all page elements of the target page except the first number of page elements.
And loading the resource information corresponding to the third number of page elements.
It should be noted that, if the target page displays the resource information corresponding to the first number of page elements, it is also necessary to display the resource information corresponding to other number of page elements in the target page. When the number of the first target page elements is less than or equal to a threshold, the resource information corresponding to other number of page elements is acquired and loaded to the target page, so that the resource information corresponding to the part of page resources is directly displayed in the following. The threshold is the first target number, which is a target value for identifying whether resource information corresponding to the third number of page elements needs to be acquired. Specifically, the specific value of the first target quantity can be set according to the requirement. For example, the first target number may be set to be equal to the first number, so that after the resource information corresponding to the second number of page elements is displayed in the target page, or after all or part of the resource information corresponding to the first target page element is displayed, since the number of the first target page elements is smaller than the first target number, the resource information corresponding to the third number of page elements is directly obtained and loaded. Of course, the first target number may be set to other values smaller than the first number, such as being equal to the first threshold number, but is not limited thereto. In a case where the first target number is equal to the first threshold number, the resource information corresponding to the first target page element of the first threshold number may be displayed each time the resource information corresponding to the first target page element is displayed. Therefore, when the number of the remaining first target page elements is less than or equal to the first threshold number, the resource information corresponding to the third number of page elements is acquired and loaded. And then, after the resource information of all the first target page elements is displayed, starting to display the resource information corresponding to the third number of page elements.
Here, the process of loading the resource information corresponding to each of the third number of page elements is similar to the process of loading the resource information in step 102, and is not described here again to avoid repetition. Preferably, the third number may be equal to the first number, that is, the page elements in the target page may be divided into multiple groups of the same number, and the resource information of one group of page elements is obtained each time the resource information of the page elements of the target page is obtained from the server. For example, the number of page elements in the target page is 30, and the page elements may be divided into a first group, a second group, and a third group in advance, where each group includes resource information of 10 page elements that do not repeat each other. The resource information of the page elements in the first group may be acquired when the resource information of the page elements in the first number is acquired, and the resource information of the page elements in the second group may be acquired when the resource information of the page elements in the third number is acquired. If the resource information of the page element needs to be acquired again from the server, the resource information of the page element in the third group may be acquired.
And displaying part or all of the resource information corresponding to the second target page elements under the condition that the second target input of the user on the target page is received and the number of the first target page elements is less than the preset number, wherein the second target page elements are page elements which do not display the resource information in the third number of page elements.
It should be noted that the second target page element is a page element, of the third number of page elements, for which resource information is not displayed. That is to say, when the resource information corresponding to the first number of page elements has been completely displayed or the number of the remaining page elements that do not display the resource information is smaller, for example, smaller than the first threshold number, if a second target input of the user on the target page is received, part or all of the resource information corresponding to the second target page element is displayed. The preset number is a target value for identifying whether the resource information corresponding to the first number of page elements has been completely displayed or whether the number of page elements of the remaining undisplayed resource information is smaller, for example, smaller than the first threshold number. Specifically, the specific numerical value of the preset quantity can be set according to the requirement. For example, the preset number may be set to be equal to the first threshold number, so that after the resource information corresponding to each of the second number of page elements is displayed in the target page, since the number of the first target page elements is smaller than the preset number, after the second target input of the user is received, the resource information corresponding to part or all of the second target page elements is displayed, so as to display the resource information corresponding to the first threshold number or other values of page elements. Of course, the preset number may also be set to other values smaller than the first number, for example, may be set to be equal to the first threshold number, but is not limited thereto. When the preset number is equal to the first threshold number, the resource information corresponding to the first target page element of the first threshold number may be displayed each time the resource information corresponding to the first target page element is displayed. Therefore, when the number of the remaining first target page elements is smaller than or equal to the second number, the resource information corresponding to the remaining first target page elements is displayed, and simultaneously, part or all of the resource information corresponding to the second target page elements is displayed.
It is understood that, each time the second target input of the user is received, the resource information corresponding to the second target page element will be displayed once, and the number of the second target page elements for which the resource information is displayed each time may be the same or different. Preferably, the number of second destination page elements targeted for each display of resource information may be related to the number of all second destination page elements. Here, a second threshold number may be set, and in a case where the number of all the second target page elements is greater than or equal to the second threshold number, the number of the second target page elements for which the resource information is displayed each time is equal to the second threshold number, that is, the resource information corresponding to a part of the second target page elements is displayed. And under the condition that the number of all the second target page elements is smaller than the second threshold number, displaying the resource information corresponding to all the second target page elements. Specifically, the number of the second target page elements may be continuously monitored, and when the number of the second target page elements is less than or equal to the first target number, the resource information corresponding to the fourth number of page elements is acquired, then the fourth number of page elements are processed according to the processing manner for the third number of page elements in the embodiment of the present invention, and so on until the user no longer inputs the page elements or all the page elements in the target page are displayed. Wherein the second threshold number may be the same as or different from the first threshold number.
It is understood that, in the process of loading the target page or the resource information loaded by the target page, a DOM (Document Object Model) tree is generated, wherein the DOM tree comprises a plurality of DOM nodes, and each page element corresponds to one DOM node. In the case where the number of page elements acquired from the server each time is equal, DOM nodes corresponding to the first number of page elements acquired for the first time may be multiplexed.
In the embodiment of the invention, the number of the first target page elements can be continuously monitored, so that when the number of the first target page elements is in a reasonable value, the resource information of the remaining page elements in the target page is obtained again. Therefore, when the first acquired resource information of the first number of page elements is displayed or is to be displayed, at least part of the resource information of the rest page elements can be loaded in the target page as soon as possible.
Optionally, displaying resource information corresponding to each of a second number of page elements in the first number of page elements includes:
a second number of page elements is selected among the first number of page elements according to a first target policy.
In this step, only the resource information corresponding to part of the page elements needs to be selected from the first number of page elements loaded to the target page for display, so the first target policy is preset here for selecting the page elements that currently need to display the resource information, that is, the second number of page elements. The first target policy may be any selection rule, for example, the selection may be performed in an order from large to small according to the data size of the resource information corresponding to the page element, or may be performed in an order from early to late according to the time when the resource information of the page element is loaded in the target page.
The attribute values of the target attributes of the second number of page elements are all adjusted to the first attribute value for displaying the page elements.
In this step, a target attribute in a Cascading Style Sheets (CSS) file corresponding to the target page may be adjusted, and an attribute value of the target attribute of the second number of page elements may be set as the first attribute value. The target attribute may be a display attribute, a visibility attribute, an accessibility attribute, or the like in the CSS file. Taking the display attribute as an example for explanation, in the case that the target attribute is the display attribute, the first attribute value may be an attribute value that does not affect display of the page element, such as block, inline, and the like. If the target attribute is a visibility attribute, the first attribute value is visible.
And adjusting the attribute values of the target attributes of the remaining page elements to be second attribute values for hiding the page elements, wherein the remaining page elements are the page elements except the second number of page elements in the first number of page elements.
In this step, the target attribute in the CSS file corresponding to the target page may also be adjusted, and the attribute value of the target attribute of the remaining page elements may be set to the second attribute value. Wherein, regarding the target attribute, the detailed description is omitted here. In the case where the target attribute is a display attribute, the second attribute value may be none. If the target attribute is the visibility attribute, the second attribute value is hidden.
In the embodiment of the invention, the target attribute in the CSS file can be utilized to control the hiding and the displaying of the page element, thereby controlling the hiding and the displaying of the resource information.
Optionally, displaying resource information corresponding to a portion of the first target page element includes:
and selecting part of the first target page elements from all the first target page elements according to a second target strategy.
In this step, since only the resource information corresponding to a part of the first target page elements needs to be selected from all the first target page elements for display, a second target policy is preset here for selecting the first target page elements currently needing to display the resource information. The second target policy may be any selection rule, which is similar to the first target policy and is not described herein again.
The attribute values of the target attributes of part of the first target page elements are all adjusted to be first attribute values used for displaying the page elements, and the attribute values of the target attributes of the rest of the first target page elements are all adjusted to be second attribute values used for hiding the page elements.
It should be noted that the target attribute in the CSS file corresponding to the target page may be adjusted, and the attribute value of the target attribute of the corresponding first target page element may be adjusted. For the target attribute, the first attribute value, and the second attribute value, reference may be made to the foregoing embodiments of the invention, and details are not described here again.
In the embodiment of the invention, the target attribute in the CSS file can be utilized to control the hiding and the displaying of the first target page element, so as to control the hiding and the displaying of the resource information.
Optionally, the first number of page elements may be page elements formed by the same type of HTML tags, and/or page elements whose corresponding resource information is greater than or equal to a preset value.
It should be noted that the same type of HTML tag can be any type of HTML tag. It can be understood that, in the case of loading the target page, resource information corresponding to the page elements formed by the target HTML tag is also obtained, where the target HTML tag is an HTML tag different from the HTML tags of the first number of page elements. For example, there are usually a large number of page elements with different HTML tags in the target page, so that after the resource information corresponding to each page element is loaded in the target page, various texts, pictures, videos, hyperlinks and the like can be displayed in the target page.
In the embodiment of the present invention, the first number of page elements may be page elements formed by HTML tags of the same type and/or page elements whose corresponding resource information is greater than or equal to a preset value, so that a large number of page elements having HTML tags of the same type and/or page elements whose corresponding resource information is greater than or equal to a preset value may be rapidly displayed. The preset value can be a value set arbitrarily, and the resource information being greater than or equal to the preset value indicates that the space occupied by the resource information is large.
Alternatively, the same type of HTML tag may include an iframe tag.
It should be noted that the iframe tag is one of HTML tags, which is also called an inline frame tag. Generally, the space occupied by the resource information corresponding to the iframe element formed by the iframe tag is large, and the time required for loading is also long.
In the embodiment of the invention, the acquired iframe resource information can be completely loaded to the target page when the iframe resource information is loaded for the first time aiming at the page elements formed by the iframe tags, so that the residual iframe resource information can be quickly displayed when needing to be displayed, the waiting time of a user is shortened, and the use experience of the user is improved.
Optionally, when the resource information corresponding to multiple page elements is obtained, the resource information corresponding to each page element may be downloaded simultaneously in an asynchronous downloading manner. Of course, when the resource information corresponding to a plurality of page elements is loaded, the resource information corresponding to each page element may also be loaded simultaneously in an asynchronous loading manner.
In the embodiment of the invention, different page elements can be operated simultaneously in an asynchronous downloading and asynchronous loading mode, so that the operation efficiency is improved.
Referring to fig. 2, a flowchart of an actual application of the method for loading page resources provided in the embodiment of the present invention, taking a web page in a browser as an example, includes:
step 201: and entering a webpage, and opening the target webpage through the browser after the browser is started in the terminal equipment.
Step 202: the browser sends request data to the background server based on the currently opened target webpage, and requests the target webpage to load the required resource information. Here, it may be assumed that a large number of page elements are involved in the target web page, and a plurality of iframe elements are included, for example, 30 iframe elements. For the iframe elements, only resource information corresponding to 10 iframe elements can be requested this time.
Step 203: and displaying the data of the current operation. And after receiving the resource information, the browser loads all the resource information to the target page. Similarly, for the iframe elements, all the resource information corresponding to the first 10 iframe elements is loaded to the target page, then only one of the iframe elements is displayed, the resource information corresponding to the first iframe element is displayed on the target page, and the resource information corresponding to the remaining 9 iframe elements is in a hidden state. Specifically, the resource information can be hidden and displayed through the attribute of the CSS file.
Step 204: and operating the data, and operating the resource information corresponding to the currently displayed first iframe element by the user.
Step 205: judging whether preloading is triggered, if so, executing step 202, acquiring resource information corresponding to middle 10 iframe elements, loading all the acquired resource information to a target page, and repeatedly executing step 203, step 204 and step 205; if not, go to step 206. The condition for triggering the preloading may be that the number of iframe elements, in which the resource information is not displayed, in the obtained iframe elements reaches 2.
In this step, the user operates the presented data, and when the remaining rendered but not presented data needs to be switched, the attribute value of the CSS of the non-presented data is adjusted to the second attribute value for display by the attribute of the CSS.
Step 206: and ending the operation, namely judging whether the number of iframe elements which do not display the resource information is zero or not, if so, executing the step 207, otherwise, continuing to execute the step 204 until the resource information corresponding to 30 iframe elements is completely displayed. If the user operates the resource information corresponding to the first iframe element in step 204, the resource information corresponding to the second iframe element is directly displayed for the user to operate after step 206.
Step 207: and closing the webpage based on the closing operation input by the user.
In the embodiment of the invention, under the scene that the browser loads the page resources, the method for loading the page resources is combined with the preloading, so that the waiting time of a user is further shortened, and the use experience of the user is improved.
With the above description of the method for loading page resources provided by the embodiment of the present invention, a device for loading page resources provided by the embodiment of the present invention will be described with reference to the accompanying drawings.
Referring to fig. 3, an embodiment of the present invention further provides an apparatus for loading a page resource, where the apparatus includes:
a first obtaining module 31, configured to obtain resource information corresponding to each of a first number of page elements in a target page when the target page is loaded;
a first loading module 31, configured to load resource information corresponding to each of a first number of page elements;
a first display module 33, configured to display resource information corresponding to a second number of page elements in the first number of page elements, where a numerical value of the second number is smaller than a numerical value of the first number;
the second display module 34 is configured to, when a first target input of the user is received, display resource information corresponding to all or part of first target page elements, where the first target page elements are page elements that have not displayed the resource information among the first number of page elements.
Optionally, the apparatus further comprises:
the monitoring module is used for monitoring the number of the first target page elements under the condition of displaying all or part of resource information corresponding to the first target page elements;
a second obtaining module, configured to obtain resource information corresponding to a third number of page elements when the number of the first target page elements is less than or equal to the first target number, where the third number of page elements includes some or all of the page elements of the target page except the first number of page elements;
the second loading module is used for loading the resource information corresponding to the third number of page elements;
and the third display module is used for displaying part or all of the resource information corresponding to the second target page elements when second target input of a user on the target page is received and the number of the first target page elements is less than a preset number, wherein the second target page elements are page elements which do not display the resource information in the third number of page elements.
Optionally, the first display module 33 includes:
a first selecting unit, configured to select a second number of page elements from the first number of page elements according to a first target policy;
a first attribute adjusting unit, configured to adjust the attribute values of the target attributes of the second number of page elements to first attribute values for displaying the page elements;
a second attribute adjusting unit, configured to adjust attribute values of target attributes of remaining page elements to a second attribute value for hiding page elements, where the remaining page elements are page elements except the second number of page elements in the first number of page elements.
Optionally, the second display module 34 includes:
the second selection unit is used for selecting part of the first target page elements in all the first target page elements according to a second target strategy;
and the third attribute adjusting unit is used for adjusting the attribute values of the target attributes of the partial first target page elements to the first attribute values for displaying the page elements, and adjusting the attribute values of the target attributes of the rest page elements in the first target page elements to the second attribute values for hiding the page elements.
Optionally, the first number of page elements are page elements formed by hypertext markup language tags of the same type and/or page elements whose corresponding resource information is greater than or equal to a preset value.
Optionally, the same type of hypertext markup language tag comprises an iframe tag.
The device for loading page resources provided by the embodiment of the present invention can implement each process implemented by the method for loading page resources in the method embodiments of fig. 1 to fig. 2, and is not described herein again to avoid repetition.
In the embodiment of the invention, under the condition of loading the target page, the resource information corresponding to the first number of page elements in the target page is obtained, so that the resource information required to be displayed in the target page is obtained. And then all the obtained resource information which needs to be displayed in the target page is loaded into the target page, and part of the resource information which needs to be displayed in the target page is displayed. Therefore, after the first target input of the user is received, the resource information which is loaded to the target page and is not displayed is directly shown. Compared with the preloading technology, the embodiment of the invention loads all the acquired resource information to the target page when the resource information is loaded for the first time, so that the process of loading the resource information can be saved and the loaded resource information can be directly displayed when the residual resource information needs to be displayed. Especially, the resource information occupying a large space can be rapidly displayed, so that the waiting time of a user is shortened, and the use experience of the user is improved.
On the other hand, an embodiment of the present invention further provides an electronic device, which includes a memory, a processor, a bus, and a computer program that is stored in the memory and is executable on the processor, where the processor implements the steps in the method for loading page resources when executing the program.
For example, fig. 4 shows a schematic physical structure diagram of an electronic device.
As shown in fig. 4, the electronic device may include: a processor (processor) 410, a communication Interface 420, a memory (memory) 430 and a communication bus 440, wherein the processor 410, the communication Interface 420 and the memory 430 are communicated with each other via the communication bus 440. The processor 410 may call logic instructions in the memory 430 to perform the following method:
under the condition of loading a target page, acquiring resource information corresponding to a first number of page elements in the target page;
loading the resource information corresponding to the first number of page elements;
displaying resource information corresponding to a second number of page elements in the first number of page elements, wherein the numerical value of the second number is smaller than the numerical value of the first number;
and under the condition that first target input of a user is received, displaying resource information corresponding to all or part of first target page elements, wherein the first target page elements are page elements which do not display the resource information in the first number of page elements.
In addition, the logic instructions in the memory 430 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes 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 steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, 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.
In another aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is implemented, when executed by a processor, to perform the method for loading a page resource provided in the foregoing embodiments, for example, the method includes:
under the condition of loading a target page, acquiring resource information corresponding to a first number of page elements in the target page;
loading the resource information corresponding to the first number of page elements;
displaying resource information corresponding to a second number of page elements in the first number of page elements, wherein the numerical value of the second number is smaller than the numerical value of the first number;
and displaying resource information corresponding to all or part of first target page elements under the condition of receiving first target input of a user, wherein the first target page elements are page elements which do not display the resource information in the first number of page elements.
The above-described embodiments of the apparatus are merely illustrative, and 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, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for loading page resources, the method comprising:
under the condition of loading a target page, acquiring resource information corresponding to a first number of page elements in the target page;
loading the resource information corresponding to the first number of page elements;
displaying resource information corresponding to a second number of page elements in the first number of page elements, wherein the numerical value of the second number is smaller than the numerical value of the first number;
and displaying resource information corresponding to all or part of first target page elements under the condition of receiving first target input of a user, wherein the first target page elements are page elements which do not display the resource information in the first number of page elements.
2. The method according to claim 1, wherein in case of displaying resource information corresponding to all or part of the first target page element, the method further comprises:
monitoring the number of the first target page elements;
acquiring resource information corresponding to a third number of page elements when the number of the first target page elements is less than or equal to a first target number, wherein the third number of page elements comprises part or all of all page elements of the target page except the first number of page elements;
loading the resource information corresponding to the third number of page elements;
and displaying part or all of the resource information corresponding to the second target page elements under the condition that second target input of a user on the target page is received and the number of the first target page elements is less than a preset number, wherein the second target page elements are page elements which do not display the resource information in the third number of page elements.
3. The method of claim 1, wherein displaying the resource information corresponding to each of the second number of page elements in the first number of page elements comprises:
selecting a second number of page elements from the first number of page elements according to a first target policy;
adjusting the attribute values of the target attributes of the second number of page elements to the first attribute values for displaying the page elements;
and adjusting the attribute values of the target attributes of the remaining page elements to be second attribute values for hiding the page elements, wherein the remaining page elements are the page elements except the second number of page elements in the first number of page elements.
4. The method of claim 1, wherein displaying the resource information corresponding to the partial first target page element comprises:
selecting a part of first target page elements from all the first target page elements according to a second target strategy;
and adjusting the attribute values of the target attributes of the partial first target page elements to be first attribute values for displaying the page elements, and adjusting the attribute values of the target attributes of the rest page elements in the first target page elements to be second attribute values for hiding the page elements.
5. The method according to claim 1, wherein the first number of page elements are page elements formed by hypertext markup language tags of the same type and/or page elements with corresponding resource information greater than or equal to a preset value.
6. The method of claim 5, wherein the same type of hypertext markup language tag comprises an inline frame iframe tag.
7. An apparatus for loading page resources, the apparatus comprising:
the first acquisition module is used for acquiring resource information corresponding to a first number of page elements in a target page under the condition of loading the target page;
a first loading module, configured to load resource information corresponding to each of the first number of page elements;
a first display module, configured to display resource information corresponding to a second number of page elements in the first number of page elements, where a numerical value of the second number is smaller than a numerical value of the first number;
and a second display module, configured to display resource information corresponding to all or part of the first target page elements when a first target input of a user is received, where the first target page element is a page element, in the first number of page elements, for which the resource information is not displayed.
8. The apparatus of claim 7, further comprising:
the monitoring module is used for monitoring the number of the first target page elements under the condition of displaying all or part of resource information corresponding to the first target page elements;
a second obtaining module, configured to obtain resource information corresponding to a third number of page elements when the number of the first target page elements is less than or equal to a first target number, where the third number of page elements includes some or all of all page elements of the target page, except for the first number of page elements;
a second loading module, configured to load resource information corresponding to each of the third number of page elements;
and a third display module, configured to display resource information corresponding to part or all of the second target page elements when a second target input of the user on the target page is received and the number of the first target page elements is smaller than a preset number, where the second target page element is a page element that does not display the resource information in the third number of page elements.
9. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, characterized in that the computer program, when executed by the processor, implements the steps of the method of loading page resources according to any of claims 1 to 6.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method for loading page resources according to any one of claims 1 to 6.
CN202210687864.XA 2022-06-17 2022-06-17 Method and device for loading page resources and electronic equipment Pending CN115186207A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210687864.XA CN115186207A (en) 2022-06-17 2022-06-17 Method and device for loading page resources and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210687864.XA CN115186207A (en) 2022-06-17 2022-06-17 Method and device for loading page resources and electronic equipment

Publications (1)

Publication Number Publication Date
CN115186207A true CN115186207A (en) 2022-10-14

Family

ID=83514227

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210687864.XA Pending CN115186207A (en) 2022-06-17 2022-06-17 Method and device for loading page resources and electronic equipment

Country Status (1)

Country Link
CN (1) CN115186207A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115776598A (en) * 2022-11-15 2023-03-10 聚好看科技股份有限公司 Server, display equipment and loading method of video playing component

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115776598A (en) * 2022-11-15 2023-03-10 聚好看科技股份有限公司 Server, display equipment and loading method of video playing component
CN115776598B (en) * 2022-11-15 2024-05-03 聚好看科技股份有限公司 Server, display device and loading method of video playing component

Similar Documents

Publication Publication Date Title
US20190251143A1 (en) Web page rendering method and related device
US10733259B2 (en) Web page access method and apparatus
KR101651524B1 (en) New tab pages and bookmark toolbars in a browser
US6983331B1 (en) Selective display of content
CN111639289A (en) Webpage loading method and device
EP3455695A1 (en) Page component dynamic layout
CN105867714B (en) Application program method for down loading, apparatus and system
CN107870920B (en) Browser resource pre-pulling method and device
US20040201618A1 (en) Streaming of real-time data to a browser
CN110020325B (en) Page loading method, device, equipment and readable storage medium
CN110647699A (en) Web page rendering method and device, computer equipment and storage medium
CN106294658A (en) The quick methods of exhibiting of webpage and device
EP4198773A1 (en) Image processing method and apparatus, and computer readable storage medium
CN113703893B (en) Page rendering method, device, terminal and storage medium
CN107402938A (en) page display method, device and client device
CN109740081A (en) Page loading method and device
CN110119490A (en) Web browser method, device, computer equipment and storage medium
CN115186207A (en) Method and device for loading page resources and electronic equipment
CN112926002A (en) Service request processing method and device
CN115438290A (en) Method and system for automatically analyzing static resources of single-page application and preloading
CN113961298A (en) Page switching method, device, equipment and medium
CN111563213B (en) Page carousel method, device, computer equipment and readable storage medium
CN114063958A (en) Page split-screen display method and device
CN113468450A (en) Page control method and device
CN113760281A (en) Transition animation realization method and device, terminal equipment and storage medium

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