WO2017049974A1 - 页面加载方法和装置 - Google Patents

页面加载方法和装置 Download PDF

Info

Publication number
WO2017049974A1
WO2017049974A1 PCT/CN2016/086837 CN2016086837W WO2017049974A1 WO 2017049974 A1 WO2017049974 A1 WO 2017049974A1 CN 2016086837 W CN2016086837 W CN 2016086837W WO 2017049974 A1 WO2017049974 A1 WO 2017049974A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
page
loading
code
script code
Prior art date
Application number
PCT/CN2016/086837
Other languages
English (en)
French (fr)
Inventor
杨凯
Original Assignee
北京奇虎科技有限公司
奇智软件(北京)有限公司
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 北京奇虎科技有限公司, 奇智软件(北京)有限公司 filed Critical 北京奇虎科技有限公司
Publication of WO2017049974A1 publication Critical patent/WO2017049974A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • 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

Definitions

  • the present invention relates to the field of Internet technologies, and in particular, to a page loading method and apparatus.
  • video, image, audio and other elements can be added to the webpage.
  • the content is not only rich, but the quality is also higher and higher. Users can watch videos and pictures directly on the webpage, and can listen to music in the webpage, etc., and improve the user. Use experience.
  • the large number of elements contained in the webpage also makes the webpage loading process slower.
  • the slow loading of the webpage will cause the webpage to display slowly, which makes the user wait for a long time to view the webpage.
  • the present invention has been made in order to provide a page loading method and apparatus that overcomes the above problems or at least partially solves or alleviates the above problems.
  • a page loading method where a page to be loaded includes a structure code, a script code, and the script code includes information for a first file to be displayed on the page,
  • the method includes: loading the structure code; loading the script code after the structure code is loaded, and loading the script according to the information of the first file included in the script code when loading the script code
  • the first file is described for presentation on the page.
  • a page loading apparatus wherein a page to be loaded includes a structure code, a script code, and the script code includes information for a first file to be displayed on the page
  • the device includes: a structure code loading module for loading the structure code; a script code loading module, configured to load the script code after loading the structure code, and when loading the script code, according to the The information of the first file included in the script code loads the first file to be displayed on the page.
  • a computer program comprising computer readable code that, when executed on a computing device, causes the computing device to perform the page loading method described above.
  • a computer readable medium storing the above computer program is provided.
  • the structure code of the webpage is first loaded, and the script code of the webpage is loaded after the structure code of the webpage is loaded; in the existing webpage structure, the information of the file used in the webpage is recorded on the webpage.
  • this causes the structure code of the webpage to be loaded slowly, which causes the structure of displaying the webpage according to the structure code to also become slow; according to the technical solution of the present invention, since the file information is recorded in the script code, the structure code is loaded. Faster, the structure of the web page can be displayed to the user faster, allowing the user to view the web page earlier.
  • FIG. 1 shows a flow chart of a page loading method according to an embodiment of the present invention
  • FIG. 2 shows a flow chart of a page loading method in accordance with one embodiment of the present invention
  • FIG. 3 shows a flow chart of a page loading method according to an embodiment of the present invention
  • Figure 4 shows a block diagram of a page loading device in accordance with one embodiment of the present invention
  • Figure 5 shows a block diagram of a page loading device in accordance with one embodiment of the present invention
  • Figure 6 shows a block diagram of a page loading device in accordance with one embodiment of the present invention
  • Figure 7 is a schematic block diagram showing a computing device for performing a page loading method in accordance with the present invention.
  • Fig. 8 schematically shows a storage unit for holding or carrying program code implementing a page loading method according to the present invention.
  • an embodiment of the present invention provides a page loading method.
  • the page to be loaded includes structure code and script code, and the script code includes information for displaying the first file on the page.
  • the more common structure code is HTML
  • the more common script code is JavaScript.
  • the information of the file is recorded in the structure code, which is different from the present embodiment.
  • the method of this embodiment includes:
  • Step 110 loading the structure code.
  • the structure code since the structure code does not include the file information, the file does not need to be loaded when the structure code is loaded, and the files of the video, the picture, the audio, and the like are large in size, and the structure code is not required to be loaded soon. Once the loading is complete, the overall structure of the web page can be presented to the user quickly.
  • Step 120 After the structure code is loaded, the script code is loaded, and when the script code is loaded, the first file is loaded to be displayed on the page according to the information of the first file included in the script code.
  • the role of the scripting language is to interact with the user, and the user often does not operate at the beginning of the webpage opening, even if the loading is slow due to the need to load the file, the interaction between the user and the webpage is not affected.
  • a page loading method includes a structure code and a script code, and the script code includes information for displaying the first file on the page.
  • the structure code includes information of the second file corresponding to the first file, and the volume of the second file is smaller than the first file.
  • the method of this embodiment includes:
  • Step 210 Load the structure code, and when loading the structure code, load the second file according to the information of the second file to display on the page.
  • the second file is replaced by the second file in the structure code, which can ensure the normal display of the webpage and ensure that the loading speed of the webpage is faster.
  • the first file and the second file are all pictures, and the second file is 1 pixel.
  • the second file image of 1 pixel is loaded very fast, and the structure code can be loaded as soon as possible. For example, a position of the webpage needs to display a larger image, and HTML A 1-pixel image is added to the img tag in the code, and the HTML is quickly loaded and waiting for JavaScript. The larger image in the code is loaded and the 1 pixel image is replaced.
  • Step 220 After the structure code is loaded, the script code is loaded, and when the script code is loaded, according to the information of the first file included in the script code, the first file is loaded to be displayed on the page, and the first file is used to replace the page.
  • the number of the first files is plural, and the number of the second files is one. In the case that multiple first files need to be loaded in the webpage, only one second file needs to be loaded, which greatly improves the loading efficiency of the structure code.
  • a page loading method is provided.
  • the page to be loaded includes a structure code and a script code, and the script code includes information for displaying the first file on the page.
  • the method of this embodiment includes:
  • Step 310 loading the structure code.
  • Step 320 After the structure code is loaded, the script code is loaded, and when the script code is loaded, the first file is loaded to be displayed on the page according to the information of the first file included in the script code.
  • the information of the first file is a picture link.
  • Image-based links can effectively capture images for loading.
  • the image link contains dynamic parameters
  • the script code is used to control the value change of the dynamic parameter.
  • the step 320 further includes: when loading the script code, calculating a current value of the dynamic parameter according to the script code; after substituting the current value into the image link, acquiring the image according to the image link to load.
  • multiple pictures may be set in the preset gallery, and each picture sets a different link address; and when the script is loaded, the dynamic parameters in the script control picture link are changed regularly or randomly, so that the picture link is One of the link addresses of the plurality of pictures, so that one of the pictures can be loaded from the plurality of pictures to be loaded regularly or randomly.
  • the pictures loaded by the web pages are different, and thus become more rich.
  • Step 330 When the first file is a plurality of pictures, the plurality of pictures are scaled to be displayed in a waterfall manner on the page; specifically, the number of columns arranged on the page by the width of the page and the preset multiple pictures , calculate the width of the scaled multiple images; scale multiple images by width and display them on the page.
  • the picture can be compactly displayed on the page by means of a waterfall flow, and further, by scaling the picture, the pictures of different sizes can be arranged on the page as a compact waterfall flow. formula.
  • a page loading apparatus includes a structure code and a script code, and the script code includes information for displaying the first file on the page.
  • the more common structure code is HTML
  • the more common script code is JavaScript.
  • the information of the file is recorded in the structure code, which is different from the present embodiment.
  • the device of this embodiment includes:
  • the structure code loading module 410 loads the structure code.
  • the structure code does not include the file information, the file does not need to be loaded when the structure code is loaded, and the files of the video, the picture, the audio, and the like are large in size, and the structure code is not required to be loaded soon. Once the loading is complete, the overall structure of the web page can be presented to the user quickly.
  • the script code loading module 420 loads the script code after the structure code is loaded, and loads the first file to be displayed on the page according to the information of the first file included in the script code when the script code is loaded.
  • the role of the scripting language is to interact with the user, and the user often does not operate at the beginning of the webpage opening, even if the loading is slow due to the need to load the file, the interaction between the user and the webpage is not affected.
  • a page loading apparatus As shown in FIG. 5, in an embodiment of the present invention, a page loading apparatus is provided.
  • the page to be loaded includes a structure code and a script code, and the script code includes information for displaying the first file on the page.
  • the structure code includes information of the second file corresponding to the first file, and the volume of the second file is smaller than the first file.
  • the device of this embodiment includes:
  • the structure code loading module 510 loads the structure code, and when loading the structure code, loads the second file according to the information of the second file to be displayed on the page.
  • the second file is replaced by the second file in the structure code, which can ensure the normal display of the webpage and ensure that the loading speed of the webpage is faster.
  • the first file and the second file are all pictures, and the second file is 1 pixel.
  • the second file image of 1 pixel is loaded very fast, and the structure code can be loaded as soon as possible. For example, a position of the webpage needs to display a larger image, and HTML A 1-pixel image is added to the img tag in the code. After the HTML is quickly loaded, the larger image in the JavaScript code is loaded and the 1-pixel image is replaced.
  • the script code loading module 520 loads the script code after the structure code is loaded, and loads the script code according to the information of the first file included in the script code. A file is displayed on the page.
  • the replacement module 530 replaces the second file presented on the page with the first file.
  • the normal display of the webpage can be guaranteed.
  • the number of the first files is plural, and the number of the second files is one. In the case that multiple first files need to be loaded in the webpage, only one second file needs to be loaded, which greatly improves the loading efficiency of the structure code.
  • an embodiment of the present invention provides a page loading apparatus.
  • the page to be loaded includes a structure code and a script code, and the script code includes information for displaying the first file on the page.
  • the device of this embodiment includes:
  • the structure code loading module 610 loads the structure code.
  • the script code loading module 620 loads the script code after the structure code is loaded, and loads the first file to be displayed on the page according to the information of the first file included in the script code when the script code is loaded.
  • the information of the first file is a picture link. Image-based links can effectively capture images for loading.
  • the image link contains dynamic parameters
  • the script code is used to control the value change of the dynamic parameter.
  • the script code loading module 620 also calculates the current value of the dynamic parameter according to the script code when the script code is loaded; after the current value is substituted into the image link, the image is acquired according to the image link to be loaded.
  • multiple pictures may be set in the preset gallery, and each picture sets a different link address; and when the script is loaded, the dynamic parameters in the script control picture link are changed regularly or randomly, so that the picture link is One of the link addresses of the plurality of pictures, so that one of the pictures can be loaded from the plurality of pictures to be loaded regularly or randomly.
  • the pictures loaded by the web pages are different, and thus become more rich.
  • the script code loading module 620 when the first file is a plurality of pictures, zooms the plurality of pictures to display on the page in a waterfall manner; specifically:
  • the width calculation module 621 calculates the width of the plurality of scaled images according to the width of the page and the number of columns of the preset plurality of pictures arranged on the page.
  • the picture zooming module 622 scales a plurality of pictures by width and displays them on the page.
  • the picture can be compactly displayed on the page by means of a waterfall flow, and further, by scaling the picture, the pictures of different sizes can be arranged on the page in the form of a compact waterfall stream. .
  • modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment.
  • the modules or units or components of the embodiments may be combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components.
  • any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the device are combined.
  • Each feature disclosed in this specification (including the accompanying claims, the abstract and the drawings) may be replaced by alternative features that provide the same, equivalent or similar purpose.
  • the various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor may be used in practice to implement some or all of the functionality of some or all of the components of the page loading device in accordance with embodiments of the present invention.
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
  • Figure 7 illustrates a computing device, such as an application server, that can implement a page loading method in accordance with the present invention.
  • the computing device conventionally includes a processor 710 and a computer program product or computer readable medium in the form of a memory 720.
  • Memory 720 can be an electronic memory such as a flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • Memory 720 has a memory space 730 for program code 731 for performing any of the method steps described above.
  • storage space 730 for program code may include various program code 731 for implementing various steps in the above methods, respectively.
  • the program code can be read from or written to one or more computer program products.
  • Such computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks.
  • Such a computer program product is typically a portable or fixed storage unit as described with reference to FIG.
  • the storage unit may have storage segments, storage spaces, and the like that are similarly arranged to memory 720 in the computing device of FIG.
  • the program code can be compressed, for example, in an appropriate form.
  • the storage unit includes computer readable code 731', ie, code readable by a processor, such as 710, that when executed by a computing device causes the computing device to perform each of the methods described above step.

Landscapes

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

Abstract

本发明公开了一种页面加载方法和装置,待加载的页面中包含结构代码、脚本代码,脚本代码中包含用于在页面上展现的第一文件的信息,方法包括:加载结构代码;在结构代码加载完成后加载脚本代码,并在加载脚本代码时,根据脚本代码中包含的第一文件的信息,加载第一文件以在页面上展现。根据本发明的技术方案,由于文件信息记录在脚本代码中,所以结构代码的加载速度较快,则网页的结构也可以更快地显示给用户,使用户可以更早地观看到网页。

Description

页面加载方法和装置 技术领域
本发明涉及互联网技术领域,尤其涉及一种页面加载方法和装置。
背景技术
目前,网页中可以加入视频、图像、音频等元素,不但内容十分丰富,而质量也越来越高,用户可以直接在网页中观看影片、图片,可以在网页中收听音乐等,为用户提高了使用体验。
但网页中包含的大量元素,也使得网页加载的过程中比较缓慢,网页加载缓慢会造成网页的显示也比较慢,这就使得用户需要等待较长的时间才能观看网页。
发明内容
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决或者减缓上述问题的页面加载方法和装置。
根据本发明的一个方面,提供了一种页面加载方法,待加载的页面中包含结构代码、脚本代码,所述脚本代码中包含用于在所述页面上展现的第一文件的信息,所述方法包括:加载所述结构代码;在所述结构代码加载完成后加载所述脚本代码,并在加载所述脚本代码时,根据所述脚本代码中包含的所述第一文件的信息,加载所述第一文件以在所述页面上展现。
根据本发明的另一个方面,提供了一种页面加载装置,待加载的页面中包含结构代码、脚本代码,所述脚本代码中包含用于在所述页面上展现的第一文件的信息,所述装置包括:结构代码加载模块,用于加载所述结构代码;脚本代码加载模块,用于在所述结构代码加载完成后加载所述脚本代码,并在加载所述脚本代码时,根据所述脚本代码中包含的所述第一文件的信息,加载所述第一文件以在所述页面上展现。
根据本发明的又一个方面,提供了一种计算机程序,其包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行上述页面加载方法。
根据本发明的再一个方面,提供了一种计算机可读介质,其中存储了上述计算机程序。
本发明的有益效果为:
对于网页加载过程来说,首先加载网页的结构代码,在网页的结构代码加载完成后再加载网页的脚本代码;在现有的网页结构中,网页中使用的文件的信息都是记录在网页的结构代码中,这就造成网页的结构代码加载缓慢,这就导致根据结构代码显示网页的结构也变得缓慢;根据本发明的技术方案,由于文件信息记录在脚本代码中,所以结构代码的加载速度较快,则网页的结构也可以更快地显示给用户,使用户可以更早地观看到网页。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1示出了根据本发明的一个实施例的页面加载方法的流程图;
图2示出了根据本发明的一个实施例的页面加载方法的流程图;
图3示出了根据本发明的一个实施例的页面加载方法的流程图;
图4示出了根据本发明的一个实施例的页面加载装置的框图;
图5示出了根据本发明的一个实施例的页面加载装置的框图;
图6示出了根据本发明的一个实施例的页面加载装置的框图;
图7示意性地示出了用于执行根据本发明的页面加载方法的计算设备的框图;以及
图8示意性地示出了用于保持或者携带实现根据本发明的页面加载方法的程序代码的存储单元。
具体实施方式
下面结合附图和具体的实施方式对本发明作进一步的描述。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。
如图1所示,本发明的一个实施例中提供了一种页面加载方法,待加载的页面中包含结构代码、脚本代码,脚本代码中包含用于在页面上展现的第一文件的信息。在本实施例中,较常见的结构代码是HTML,较常见的脚本代码是JavaScript。现有技术中的网页,文件的信息记录在结构代码中,这与本实施例不同。本实施例的方法包括:
步骤110,加载结构代码。在本实施例中,由于结构代码中不包含文件信息,所以不需要在加载结构代码时加载文件,视频、图片、音频等文件的体积都较大,不需要对其加载后结构代码很快可以加载完成,网页的整体结构可以很快地呈现给用户。
步骤120,在结构代码加载完成后加载脚本代码,并在加载脚本代码时,根据脚本代码中包含的第一文件的信息,加载第一文件以在页面上展现。在本实施例中,由于脚本语言的作用是与用户之间进行交互,而用户在网页打开初期往往不会进行操作,所以即使由于需要加载文件导致加载缓慢也不会影响用户与网页的交互。
如图2所示,本发明的一个实施例中提供了一种页面加载方法,待加载的页面中包含结构代码、脚本代码,脚本代码中包含用于在页面上展现的第一文件的信息;结构代码中包含与第一文件相对应的第二文件的信息,第二文件的体积小于第一文件。本实施例的方法包括:
步骤210,加载结构代码,在加载结构代码时,根据第二文件的信息加载第二文件以在页面上展现。在本实施例中,在结构代码中使用体积小的第二文件替代第一文件,既可以保证网页正常显示,又可以保证网页的加载速度较快。具体地,第一文件、第二文件均为图片,且第二文件为1像素。相比于可能是几M大小的第一文件图片,1像素的第二文件图片加载速度非常快,可以保证结构代码尽早加载完成,例如,网页的一个位置需要显示一个较大的图片,而HTML代码中的img标签中加入了1像素图片,则HTML快速加载完成后,等待JavaScript 代码中的较大图片加载完成,对1像素图片进行替换。
步骤220,在结构代码加载完成后加载脚本代码,并在加载脚本代码时,根据脚本代码中包含的第一文件的信息,加载第一文件以在页面上展现,并使用第一文件替换页面上展现的第二文件。在本实施例中,在第一文件加载完成将第二文件替换掉,即可以保证网页的正常显示。具体地,第一文件的数量为多个,第二文件的数量为一个。则对于网页中需要加载多个第一文件的情况下,只需要加载一个第二文件,极大地提高了结构代码的加载效率。
如图3所示,本发明的一个实施例中提供了一种页面加载方法,待加载的页面中包含结构代码、脚本代码,脚本代码中包含用于在页面上展现的第一文件的信息。本实施例的方法包括:
步骤310,加载结构代码。
步骤320,在结构代码加载完成后加载脚本代码,并在加载脚本代码时,根据脚本代码中包含的第一文件的信息,加载第一文件以在页面上展现。在本实施例中,在第一文件为图片时,第一文件的信息为图片链接。基于图片链接可以有效地获取图片进行加载。
进一步地,图片链接中包含动态参数,脚本代码用于控制动态参数的值变化。步骤320还包括:在加载脚本代码时,根据脚本代码计算动态参数的当前值;将当前值代入图片链接后,根据图片链接获取图片进行加载。在本实施例中,可以在预设图库中设置多张图片,每张图片设置不同的链接地址;而加载脚本时脚本控制图片链接中的动态参数有规则地或随机地变化,使得图片链接为多张图片的链接地址中的一个,从而可以有规则地或随机地从多张图片中获取其中一张图片进行加载,基于本实施例的技术方案,网页加载的图片不同,也就变得更加丰富。
步骤330,在第一文件为多个图片时,对多个图片进行缩放以在页面上呈瀑布流方式显示;具体包括:按页面的宽度、预设的多个图片在页面上排列的列数,计算缩放后的多个图片的宽度;按宽度对多个图片进行缩放,并显示在页面上。在本实施例的技术方案中,通过瀑布流的方式可将图片紧凑地显示在页面上,进一步地通过对图片进行缩放,使得大小不同的图片都能够在页面上布置为紧凑的瀑布流的形 式。
如图4所示,本发明的一个实施例中提供了一种页面加载装置,待加载的页面中包含结构代码、脚本代码,脚本代码中包含用于在页面上展现的第一文件的信息。在本实施例中,较常见的结构代码是HTML,较常见的脚本代码是JavaScript。现有技术中的网页,文件的信息记录在结构代码中,这与本实施例不同。本实施例的装置包括:
结构代码加载模块410,加载结构代码。在本实施例中,由于结构代码中不包含文件信息,所以不需要在加载结构代码时加载文件,视频、图片、音频等文件的体积都较大,不需要对其加载后结构代码很快可以加载完成,网页的整体结构可以很快地呈现给用户。
脚本代码加载模块420,在结构代码加载完成后加载脚本代码,并在加载脚本代码时,根据脚本代码中包含的第一文件的信息,加载第一文件以在页面上展现。在本实施例中,由于脚本语言的作用是与用户之间进行交互,而用户在网页打开初期往往不会进行操作,所以即使由于需要加载文件导致加载缓慢也不会影响用户与网页的交互。
如图5所示,本发明的一个实施例中提供了一种页面加载装置,待加载的页面中包含结构代码、脚本代码,脚本代码中包含用于在页面上展现的第一文件的信息;结构代码中包含与第一文件相对应的第二文件的信息,第二文件的体积小于第一文件。本实施例的装置包括:
结构代码加载模块510,加载结构代码,在加载结构代码时,根据第二文件的信息加载第二文件以在页面上展现。在本实施例中,在结构代码中使用体积小的第二文件替代第一文件,既可以保证网页正常显示,又可以保证网页的加载速度较快。具体地,第一文件、第二文件均为图片,且第二文件为1像素。相比于可能是几M大小的第一文件图片,1像素的第二文件图片加载速度非常快,可以保证结构代码尽早加载完成,例如,网页的一个位置需要显示一个较大的图片,而HTML代码中的img标签中加入了1像素图片,则HTML快速加载完成后,等待JavaScript代码中的较大图片加载完成,对1像素图片进行替换。
脚本代码加载模块520,在结构代码加载完成后加载脚本代码,并在加载脚本代码时,根据脚本代码中包含的第一文件的信息,加载第 一文件以在页面上展现。
替换模块530,使用第一文件替换页面上展现的第二文件。在本实施例中,在第一文件加载完成将第二文件替换掉,即可以保证网页的正常显示。具体地,第一文件的数量为多个,第二文件的数量为一个。则对于网页中需要加载多个第一文件的情况下,只需要加载一个第二文件,极大地提高了结构代码的加载效率。
如图6所示,本发明的一个实施例中提供了一种页面加载装置,待加载的页面中包含结构代码、脚本代码,脚本代码中包含用于在页面上展现的第一文件的信息。本实施例的装置包括:
结构代码加载模块610,加载结构代码。
脚本代码加载模块620,在结构代码加载完成后加载脚本代码,并在加载脚本代码时,根据脚本代码中包含的第一文件的信息,加载第一文件以在页面上展现。在本实施例中,在第一文件为图片时,第一文件的信息为图片链接。基于图片链接可以有效地获取图片进行加载。
进一步地,图片链接中包含动态参数,脚本代码用于控制动态参数的值变化。脚本代码加载模块620还在加载脚本代码时,根据脚本代码计算动态参数的当前值;将当前值代入图片链接后,根据图片链接获取图片进行加载。在本实施例中,可以在预设图库中设置多张图片,每张图片设置不同的链接地址;而加载脚本时脚本控制图片链接中的动态参数有规则地或随机地变化,使得图片链接为多张图片的链接地址中的一个,从而可以有规则地或随机地从多张图片中获取其中一张图片进行加载,基于本实施例的技术方案,网页加载的图片不同,也就变得更加丰富。
脚本代码加载模块620,在第一文件为多个图片时,对多个图片进行缩放以在页面上呈瀑布流方式显示;具体包括:
宽度计算模块621,按页面的宽度、预设的多个图片在页面上排列的列数,计算缩放后的多个图片的宽度。
图片缩放模块622,按宽度对多个图片进行缩放,并显示在页面上。在本实施例的技术方案中,通过瀑布流的方式可将图片紧凑地显示在页面上,进一步地通过对图片进行缩放,使得大小不同的图片都能够在页面上布置为紧凑的瀑布流的形式。
在此提供的算法和显示不与任何特定计算机、虚拟***或者其它设备固有相关。各种通用***也可以与基于在此的示教一起使用。根据上面的描述,构造这类***所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使 用。
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的页面加载装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。
例如,图7示出了可以实现根据本发明的页面加载方法的计算设备,例如应用服务器。该计算设备传统上包括处理器710和以存储器720形式的计算机程序产品或者计算机可读介质。存储器720可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器720具有用于执行上述方法中的任何方法步骤的程序代码731的存储空间730。例如,用于程序代码的存储空间730可以包括分别用于实现上面的方法中的各种步骤的各个程序代码731。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为如参考图8所述的便携式或者固定存储单元。该存储单元可以具有与图7的计算设备中的存储器720类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括计算机可读代码731’,即可以由例如诸如710之类的处理器读取的代码,这些代码当由计算设备运行时,导致该计算设备执行上面所描述的方法中的各个步骤。
本文中所称的“一个实施例”、“实施例”或者“一个或者多个实施例”意味着,结合实施例描述的特定特征、结构或者特性包括在本发明的至少一个实施例中。此外,请注意,这里“在一个实施例中”的词语例子不一定全指同一个实施例。
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换 实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。
此外,还应当注意,本说明书中使用的语言主要是为了可读性和教导的目的而选择的,而不是为了解释或者限定本发明的主题而选择的。因此,在不偏离所附权利要求书的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。对于本发明的范围,对本发明所做的公开是说明性的,而非限制性的,本发明的范围由所附权利要求书限定。

Claims (18)

  1. 一种页面加载方法,其中,待加载的页面中包含结构代码、脚本代码,所述脚本代码中包含用于在所述页面上展现的第一文件的信息,所述方法包括:
    加载所述结构代码;
    在所述结构代码加载完成后加载所述脚本代码,并在加载所述脚本代码时,根据所述脚本代码中包含的所述第一文件的信息,加载所述第一文件以在所述页面上展现。
  2. 根据权利要求1所述的页面加载方法,其中,所述结构代码中包含与所述第一文件相对应的第二文件的信息,所述第二文件的体积小于所述第一文件;加载所述结构代码,还包括:
    在所述加载所述结构代码时,根据所述第二文件的信息加载所述第二文件以在所述页面上展现;
    加载所述第一文件以在所述页面上展现,还包括:使用所述第一文件替换所述页面上展现的所述第二文件。
  3. 根据权利要求2所述的页面加载方法,其中,
    所述第一文件的数量为多个,所述第二文件的数量为一个。
  4. 根据权利要求2所述的页面加载方法,其中,
    所述第一文件、所述第二文件均为图片,且所述第二文件为1像素。
  5. 根据权利要求1所述的页面加载方法,其中,加载所述第一文件以在所述页面上展现,具体包括:
    在所述第一文件为多个图片时,对所述多个图片进行缩放以在所述页面上呈瀑布流方式显示。
  6. 根据权利要求5所述的页面加载方法,其中,对所述多个图片进行缩放以在所述页面上呈瀑布流方式显示,具体包括:
    按所述页面的宽度、预设的所述多个图片在所述页面上排列的列数,计算缩放后的所述多个图片的宽度;
    按所述宽度对所述多个图片进行缩放,并显示在所述页面上。
  7. 根据权利要求1所述的页面加载方法,其中,
    在所述第一文件为图片时,所述第一文件的信息为图片链接。
  8. 根据权利要求7所述的页面加载方法,其中,所述图片链接中包含动态参数,所述脚本代码用于控制动态参数的值变化;根据所述脚本代码中包含的所述第一文件的信息,加载所述第一文件以在所述页面上展现,具体包括:
    在加载所述脚本代码时,根据所述脚本代码计算所述动态参数的当前值;将所述当前值代入所述图片链接后,根据所述图片链接获取图片进行加载。
  9. 一种页面加载装置,其中,待加载的页面中包含结构代码、脚本代码,所述脚本代码中包含用于在所述页面上展现的第一文件的信息,所述装置包括:
    结构代码加载模块,用于加载所述结构代码;
    脚本代码加载模块,用于在所述结构代码加载完成后加载所述脚本代码,并在加载所述脚本代码时,根据所述脚本代码中包含的所述第一文件的信息,加载所述第一文件以在所述页面上展现。
  10. 根据权利要求9所述的页面加载装置,其中,所述结构代码中包含与所述第一文件相对应的第二文件的信息,所述第二文件的体积小于所述第一文件;
    所述结构代码加载模块还在所述加载所述结构代码时,根据所述第二文件的信息加载所述第二文件以在所述页面上展现;所述装置还包括:
    替换模块,使用所述第一文件替换所述页面上展现的所述第二文件。
  11. 根据据权利要求10所述的页面加载装置,其中,
    所述第一文件的数量为多个,所述第二文件的数量为一个。
  12. 根据据权利要求10所述的页面加载装置,其中,
    所述第一文件、所述第二文件均为图片,且所述第二文件为1像素。
  13. 根据据权利要求9所述的页面加载装置,其中,
    所述脚本代码加载模块在所述第一文件为多个图片时,对所述多个图片进行缩放以在所述页面上呈瀑布流方式显示。
  14. 根据据权利要求13所述的页面加载装置,其中,所述脚本代码加载模块包括:
    宽度计算模块,用于按所述页面的宽度、预设的所述多个图片在所述页面上排列的列数,计算缩放后的所述多个图片的宽度;
    图片缩放模块,用于按所述宽度对所述多个图片进行缩放,并显示在所述页面上。
  15. 根据据权利要求9所述的页面加载装置,其中,
    在所述第一文件为图片时,所述第一文件的信息为图片链接。
  16. 根据据权利要求15所述的页面加载装置,其中,所述图片链接中包含动态参数,所述脚本代码用于控制动态参数的值变化;
    所述脚本代码加载模块在加载所述脚本代码时,根据所述脚本代码计算所述动态参数的当前值;将所述当前值代入所述图片链接后,根据所述图片链接获取图片进行加载。
  17. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行根据权利要求1-8中的任一个所述的页面加载方法。
  18. 一种计算机可读介质,其中存储了如权利要求17所述的计算机程序。
PCT/CN2016/086837 2015-09-23 2016-06-23 页面加载方法和装置 WO2017049974A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510614363.9 2015-09-23
CN201510614363.9A CN105183883B (zh) 2015-09-23 2015-09-23 页面加载方法和装置

Publications (1)

Publication Number Publication Date
WO2017049974A1 true WO2017049974A1 (zh) 2017-03-30

Family

ID=54905964

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/086837 WO2017049974A1 (zh) 2015-09-23 2016-06-23 页面加载方法和装置

Country Status (2)

Country Link
CN (1) CN105183883B (zh)
WO (1) WO2017049974A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111125571A (zh) * 2018-10-11 2020-05-08 杭州海康存储科技有限公司 图片显示方法及装置

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105183883B (zh) * 2015-09-23 2019-07-09 北京奇虎科技有限公司 页面加载方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914450A (zh) * 2012-12-31 2014-07-09 北京新媒传信科技有限公司 移动终端平台中网页图片呈现方法和装置
CN103942307A (zh) * 2014-04-18 2014-07-23 网宿科技股份有限公司 一种基于图片流的前端加速方法
CN104268206A (zh) * 2014-09-23 2015-01-07 可牛网络技术(北京)有限公司 页面资源操作界面的展示方法、装置和移动终端
CN105183883A (zh) * 2015-09-23 2015-12-23 北京奇虎科技有限公司 页面加载方法和装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104239441A (zh) * 2014-09-01 2014-12-24 可牛网络技术(北京)有限公司 网页加载控制方法和装置
CN104462247B (zh) * 2014-11-19 2018-10-09 北京奇虎科技有限公司 网页加载方法和装置
CN104484383B (zh) * 2014-12-10 2017-11-14 北京国双科技有限公司 Js文件处理方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914450A (zh) * 2012-12-31 2014-07-09 北京新媒传信科技有限公司 移动终端平台中网页图片呈现方法和装置
CN103942307A (zh) * 2014-04-18 2014-07-23 网宿科技股份有限公司 一种基于图片流的前端加速方法
CN104268206A (zh) * 2014-09-23 2015-01-07 可牛网络技术(北京)有限公司 页面资源操作界面的展示方法、装置和移动终端
CN105183883A (zh) * 2015-09-23 2015-12-23 北京奇虎科技有限公司 页面加载方法和装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111125571A (zh) * 2018-10-11 2020-05-08 杭州海康存储科技有限公司 图片显示方法及装置
CN111125571B (zh) * 2018-10-11 2024-02-20 杭州海康存储科技有限公司 图片显示方法及装置

Also Published As

Publication number Publication date
CN105183883A (zh) 2015-12-23
CN105183883B (zh) 2019-07-09

Similar Documents

Publication Publication Date Title
JP6882992B2 (ja) 動画像をプレビューする方法及びデバイス、並びに表現パッケージを表示する方法及びデバイス
KR101939425B1 (ko) 미디어 세트의 계층적인, 줌 가능한 프레젠테이션 기법
US9562762B2 (en) Automated optical dimensioning and imaging
WO2017107833A1 (zh) 浏览器标签内的页面切换方法及装置
TWI671647B (zh) 計算頁面首屏描繪時長的方法、裝置及電子設備
WO2016202177A1 (zh) 呼叫双方信息交互方法及装置
US20130335447A1 (en) Electronic device and method for playing real-time images in a virtual reality
JP2020500357A (ja) モバイルデバイス上でアニメーション画像を提示するための方法およびデバイス
TW201415347A (zh) 縮放螢幕畫面的方法、電子裝置及電腦程式產品
TW201030537A (en) Optimize view elements sizes to maximize most data viewed in a multiple view elements GUI
CN111143739B (zh) 页面跳转方法、计算设备及计算机存储介质
US20180132012A1 (en) Method and apparatus for playing video in application program
CN108009147B (zh) 电子书封面生成方法、电子设备及计算机存储介质
CN111782873B (zh) 基于书籍视频的书籍推荐方法、电子设备及存储介质
WO2017000613A1 (zh) 在搜索结果页中生成提示信息的方法及装置
WO2017113701A1 (zh) 制作视频集锦的方法、装置、电子设备、服务器及***
JP2018528634A5 (zh)
WO2014090187A1 (zh) 在浏览器中处理页面的方法及设备
CN111783015A (zh) 页面中共享显示元素的展示方法、电子设备及存储介质
WO2017049974A1 (zh) 页面加载方法和装置
JP2008085689A5 (zh)
CN110187816B (zh) 漫画类型电子书的自动翻页方法、计算设备及存储介质
WO2017161771A1 (zh) 一种广告数据的展示方法和装置
WO2017107887A1 (zh) 在移动终端上切换组图的方法及装置
WO2018121546A1 (zh) 一种行车记录装置屏幕内容的展示方法和装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16847856

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16847856

Country of ref document: EP

Kind code of ref document: A1