WO2022218028A1 - 页面加载方法、装置、设备及存储介质 - Google Patents

页面加载方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2022218028A1
WO2022218028A1 PCT/CN2022/076356 CN2022076356W WO2022218028A1 WO 2022218028 A1 WO2022218028 A1 WO 2022218028A1 CN 2022076356 W CN2022076356 W CN 2022076356W WO 2022218028 A1 WO2022218028 A1 WO 2022218028A1
Authority
WO
WIPO (PCT)
Prior art keywords
page
loaded
file
code
resource
Prior art date
Application number
PCT/CN2022/076356
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 WO2022218028A1 publication Critical patent/WO2022218028A1/zh

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

Definitions

  • the embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a page loading method, apparatus, device, and storage medium.
  • the embodiments of the present disclosure provide a page loading method, apparatus, device, and storage medium.
  • a first aspect of the embodiments of the present disclosure provides a method for loading a page, the method includes: requesting from a server a page code of a page to be loaded, and a spliced file obtained by splicing page resources to be loaded on the page to be loaded,
  • the page code includes information about the location of the page resource in the spliced file; based on the page code, the page resource is read from the location of the spliced file, and the page resource is stored. loaded onto the page to be loaded.
  • the spliced file is obtained by splicing page resources in at least two formats.
  • the page code of the page to be loaded is obtained by requesting from the server, and the spliced file obtained by splicing the page resources to be loaded on the page to be loaded includes:
  • the server Based on the address of the page to be loaded, request the server to obtain the page code of the page to be loaded, and the page code also includes the identifier of the spliced file; based on the identifier, request the server to obtain the spliced file document.
  • the page code of the page to be loaded is obtained by requesting from the server, and the splicing file obtained by splicing the page resources to be loaded on the page to be loaded, including:
  • the information on the location of the page resource in the spliced file includes information on the starting location and data size of the page resource;
  • the reading the page resource from the location of the splicing file based on the page code includes:
  • the information of the starting position and the data size is obtained by reading the page code; according to the information of the starting position and the data size, the ending position of the page resource in the splicing file is determined ; Based on the start position and the end position, read the page resource from the splicing file.
  • a second aspect of the embodiments of the present disclosure provides a page loading method, the method includes:
  • the acquisition request includes the identifier of the spliced file; according to the identifier, the spliced file is fed back to the browser, so that the browser can convert the page based on the page code and the spliced file The resource is loaded on the to-be-loaded page.
  • a third aspect of the embodiments of the present disclosure provides a page loading method, the method includes:
  • the splicing file obtained by splicing the page resources on the page, and the page code includes the information of the position of the page resource in the splicing file, so that the browser can use the page code and the splicing file.
  • the page resource is loaded onto the to-be-loaded page.
  • a fourth aspect of the embodiments of the present disclosure provides a page loading apparatus, and the apparatus includes:
  • the request module is used to request the page code of the page to be loaded from the server, and the spliced file obtained by splicing the page resources to be loaded on the page to be loaded, the page code includes the page resources in the information about the location in the splice file;
  • a loading module configured to read the page resource from the location of the spliced file based on the page code, and load the page resource onto the to-be-loaded page.
  • the spliced file is obtained by splicing page resources in at least two formats.
  • the request module includes:
  • the first request submodule is used to request the server to obtain the page code of the page to be loaded based on the address of the page to be loaded, and the page code also includes the identification of the spliced file;
  • the second request sub-module is configured to request the server to obtain the spliced file based on the identifier.
  • the request module includes:
  • a third request submodule configured to send a download request to the server, where the download request includes the address of the page to be loaded;
  • the receiving sub-module is configured to receive the page code of the page to be loaded and the spliced file fed back by the server according to the address.
  • the information on the location of the page resource in the spliced file includes information on the starting location and data size of the page resource;
  • the load module is used to:
  • the information of the starting position and the data size is obtained by reading from the page code
  • the page resource is read from the spliced file.
  • a fifth aspect of the embodiments of the present disclosure provides a page loading apparatus, and the apparatus includes:
  • a first receiving module configured to receive a first acquisition request sent by the browser, where the first acquisition request includes the address of the page to be loaded;
  • a first feedback module configured to feed back the page code of the page to be loaded to the browser based on the address, where the page code includes a spliced file where the page resource to be loaded on the page to be loaded is located , and the information of the position of the page resource in the spliced file;
  • a second receiving module configured to receive a second acquisition request sent by the browser, where the second acquisition request includes the identifier of the spliced file;
  • a second feedback module configured to feed back the spliced file to the browser according to the identifier, so that the browser loads the page resource into the browser based on the page code and the spliced file on the page to be loaded.
  • a sixth aspect of the embodiments of the present disclosure provides a page loading apparatus, and the apparatus includes:
  • a receiving module configured to receive a download request sent by the browser, where the download request includes the address of the page to be loaded
  • a feedback module configured to feed back to the browser the page code of the page to be loaded and the spliced file obtained by splicing the page resources to be loaded on the page to be loaded to the browser according to the address, in the page code Including the location information of the page resource in the splicing file, so that the browser loads the page resource on the page to be loaded according to the page code and the splicing file.
  • a seventh aspect of the embodiments of the present disclosure provides an electronic device, the electronic device comprising:
  • a display for displaying a page of a browser or an application program carried on the electronic device
  • a processor for executing the computer program and when the computer program is executed by the processor, the processor executes the method of the first aspect.
  • An eighth aspect of the embodiments of the present disclosure provides a server, the server includes: a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processing The device performs the method of the second aspect or the third aspect above.
  • a ninth aspect of the embodiments of the present disclosure provides a computer-readable storage medium, where a computer program is stored in the storage medium, and when the computer program is executed by a processor, any one of the above-mentioned first to third aspects can be implemented Methods.
  • FIG. 1 is a flowchart of a page loading method provided by an embodiment of the present disclosure
  • FIGS. 2 and 3 are schematic diagrams of a method for acquiring page code and page resources provided by an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of another method for obtaining page code and page resources provided by an embodiment of the present disclosure
  • FIG. 5 is a flowchart of a page loading method provided by an embodiment of the present disclosure.
  • FIG. 6 is a flowchart of a page loading method provided by an embodiment of the present disclosure.
  • FIG. 7 is a flowchart of a page loading method provided by an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of a page loading apparatus provided by an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of an electronic device in an embodiment of the present disclosure.
  • FIG. 1 is a flowchart of a page loading method provided by an embodiment of the present disclosure, and the method may be executed by an electronic device.
  • the electronic device may be exemplarily understood as a device having a page display function, such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, and a smart TV.
  • the method provided by this embodiment includes the following steps:
  • Step 101 Request from the server the page code of the page to be loaded, and the spliced file obtained by splicing the page resources to be loaded on the page to be loaded, the page code includes the location of the page resource on the page to be loaded in the spliced file Information.
  • Step 102 Based on the page code of the page to be loaded, read the page resource of the page to be loaded from the corresponding position of the spliced file, and load the read page resource onto the page to be loaded.
  • the spliced file in this embodiment may be obtained by splicing multiple page resources, and the splicing manner may be, for example, end-to-end connection, but is not limited to end-to-end connection.
  • the multiple page resources constituting the spliced file may be all page resources on a certain page, or some page resources on a certain page.
  • the formats of the multiple page resources constituting the spliced file may be the same or different, that is to say, in one embodiment, the spliced file may be obtained by splicing page resources of at least two formats.
  • the page to be loaded in this embodiment may be exemplarily understood as a Hyper Text Markup Language (Hyper Text Markup Language, HTML for short) page.
  • the page code in this embodiment can be exemplarily understood as code written in HTML language.
  • the page code describes information on page resources such as pictures, videos, audios, texts, etc. on the page at least in HTML language.
  • the information of the page resource may be, for example, at least one of the name, format, and location of the page resource in the spliced file.
  • the electronic device sends a request message to the server to request the page code of the page to be loaded and the splicing file containing the page resources of the page to be loaded, and the number of splicing files may be one or more. indivual.
  • the ways for the electronic device to request page codes and splicing files include at least the following:
  • FIG. 2 and FIG. 3 are schematic diagrams of a method for obtaining page code and page resources provided by an embodiment of the present disclosure.
  • the electronic device 21 It is carried in the download request and sent to the server 22.
  • the server 22 feeds back the page code and the spliced file of the page to be loaded to the electronic device 21 by default according to the address in the download request; or, as shown in FIG.
  • the electronic device 21 can also carry the address of the page to be loaded and its own performance information, such as the supported browser type, version, network speed, etc., in the download request and send it to the server 22 at the same time, and the server 22 receives the download request. After the request, determine how to feed back the page resources of the page to be loaded according to the performance information in the download request, if the performance information in the download request meets the preset conditions (for example, the type and version of the browser conform to the preset type and version), the spliced file and page code containing the page resources of the page to be loaded are fed back to the electronic device 21 .
  • the preset conditions for example, the type and version of the browser conform to the preset type and version
  • the page code of the loaded page and the spliced file are fed back to the electronic device 21 .
  • the electronic device 21 loads the page resource at the corresponding position in the spliced file onto the page according to the location of each page resource recorded in the page code in the spliced file.
  • the electronic device may obtain the page code and the splicing file of the page to be loaded through two requests respectively.
  • FIG. 4 is a schematic diagram of another method for obtaining page codes and page resources provided by an embodiment of the present disclosure.
  • the electronic device 41 in the first request, can The address of the loaded page is carried in the request message and sent to the server 42, and the page code fed back by the server 42 according to the request message is received.
  • the page code includes the name and format of each page resource on the page, and the page resource in the spliced file. In addition to the location information, it also includes the identifier of the spliced file where each page resource is located.
  • the electronic device 41 After receiving the page code fed back by the server 42, the electronic device 41 requests the corresponding spliced file from the server 42 according to the identification of the spliced file in the page code, and according to the page code recorded on the page resource in the spliced file. position, load the page resources at the corresponding position onto the page, thereby completing the loading of the page. It should be noted that, in this implementation manner, multiple page resources on the page to be loaded may be dispersed in multiple spliced files, and the identifiers of spliced files corresponding to different page resources in the page code may also be different.
  • the splicing file can include page resources in various formats, there is no limit to the format and data size of the page resources, and it supports moving pictures and non-picture resources.
  • FIG. 5 is a flowchart of a page loading method provided by an embodiment of the present disclosure. As shown in FIG. 5 , the method provided by this embodiment includes:
  • Step 501 Requesting from the server the page code of the page to be loaded, and the splicing file obtained by splicing the page resources to be loaded on the page to be loaded, the page code includes the start of the page resource on the page to be loaded in the splicing file. Start location and data size information.
  • Step 502 Read the information of the starting position and data size of the page resource in the spliced file from the page code.
  • Step 503 Determine the ending position of the page resource in the spliced file according to the information of the starting position and data size of the page resource.
  • Step 504 based on the start position and end position of the page resource, read the page resource from the spliced file, and load the page resource onto the page to be loaded.
  • the following piece of code is the page code of a page to be loaded:
  • the address of the ending position of the picture “1.jpeg” in the splicing file can be obtained as "1999”; according to the picture "2
  • the address "2000” of the starting position of .webp” and the data size "1000”, the address of the ending position of the picture "2.webp” in the splicing file can be obtained as "2999”; according to the client script "3.js”
  • the address of the starting position "3000” and the data size "500” can be obtained, the address of the end position of the client-side script "3.js” in the splicing file is "3499".
  • this embodiment only provides a method for loading page resources from a spliced file, this method is not the only method in the present disclosure.
  • the above page code is used to represent
  • the field of the data size of the page resource can also be replaced with a field representing the address of the end position of the page resource in the spliced file. That is to say, in this case, the position of the page resource in the spliced file can be represented by the start position and the end position of the page resource in the spliced file.
  • this embodiment can help the electronic device to quickly and accurately determine the position of the page in the spliced file, thereby providing a guarantee for fast page loading.
  • FIG. 6 is a flowchart of a page loading method provided by an embodiment of the present disclosure, and the method may be executed by a server. As shown in Figure 6, the method includes:
  • Step 601 Receive a first acquisition request sent by the browser on the electronic device, where the first acquisition request includes the address of the page to be loaded.
  • Step 602 Based on the address of the page to be loaded, the page code of the page to be loaded is fed back to the browser.
  • the page code includes the identifier of the spliced file where the page resources to be loaded on the page to be loaded are located, and the page resources are spliced. Information about the location in the file.
  • Step 603 Receive a second acquisition request sent by the browser, where the second acquisition request includes the identifier of the spliced file.
  • Step 604 Feed back the corresponding splicing file to the browser according to the identifier of the splicing file, so that the browser loads the page resource on the page to be loaded based on the received page code and splicing file.
  • FIG. 7 is a flowchart of a page loading method provided by an embodiment of the present disclosure, and the method may be executed by a server. As shown in Figure 7, the method includes:
  • Step 701 Receive a download request sent by the browser on the electronic device, where the download request includes the address of the page to be loaded.
  • Step 702 Feed back to the browser the page code of the page to be loaded and the spliced file obtained by splicing the page resources to be loaded on the page to be loaded according to the address of the page to be loaded, where the page code includes the page resources in the spliced file. location information, so that the browser loads the page resources on the page to be loaded according to the received page code and splicing file.
  • FIG. 8 is a schematic structural diagram of a page loading apparatus provided by an embodiment of the present disclosure.
  • the page loading apparatus may be understood as the above electronic device or a part of functional modules in the above electronic device.
  • the page loading device 80 includes:
  • the request module 81 is used to request the page code of the page to be loaded from the server, and the spliced file obtained by splicing the page resources to be loaded on the page to be loaded, the page code includes the page resource in the information about the location in the spliced file;
  • the loading module 82 is configured to read the page resource from the location of the spliced file based on the page code, and load the page resource onto the to-be-loaded page.
  • the spliced file is obtained by splicing page resources in at least two formats.
  • the request module 81 includes:
  • a first request submodule configured to request the server to obtain the page code of the page to be loaded based on the address of the page to be loaded, and the page code also includes the identifier of the spliced file;
  • the second request sub-module is configured to request the server to obtain the spliced file based on the identifier.
  • the request module 81 includes:
  • a third request submodule configured to send a download request to the server, where the download request includes the address of the page to be loaded;
  • the receiving sub-module is configured to receive the page code of the page to be loaded and the spliced file fed back by the server according to the address.
  • the information on the location of the page resource in the spliced file includes information on the starting location and data size of the page resource;
  • the loading module 82 is used for:
  • the information of the starting position and the data size is obtained by reading from the page code
  • the page resource is read from the spliced file.
  • the apparatus provided in this embodiment can execute the method in any of the foregoing embodiments in FIG. 1 to FIG. 5 , and the execution manner and beneficial effects thereof are similar, which will not be repeated here.
  • the present disclosure also provides a page loading apparatus, where the page loading apparatus may be understood as the server in the above-mentioned embodiment or a part of functional modules in the server.
  • the page loading means may include:
  • a first receiving module configured to receive a first acquisition request sent by the browser, where the first acquisition request includes the address of the page to be loaded;
  • a first feedback module configured to feed back the page code of the page to be loaded to the browser based on the address, where the page code includes a spliced file where the page resource to be loaded on the page to be loaded is located , and the information of the position of the page resource in the spliced file;
  • a second receiving module configured to receive a second acquisition request sent by the browser, where the second acquisition request includes the identifier of the spliced file;
  • a second feedback module configured to feed back the spliced file to the browser according to the identifier, so that the browser loads the page resource into the browser based on the page code and the spliced file on the page to be loaded.
  • the page loading means may include:
  • a receiving module configured to receive a download request sent by the browser, where the download request includes the address of the page to be loaded
  • a feedback module configured to feed back to the browser the page code of the page to be loaded and the spliced file obtained by splicing the page resources to be loaded on the page to be loaded to the browser according to the address, in the page code Including the location information of the page resource in the splicing file, so that the browser loads the page resource on the page to be loaded according to the page code and the splicing file.
  • the apparatus provided in this embodiment can execute the method in the embodiment in FIG. 6 or FIG. 7 , and the execution manner and beneficial effects thereof are similar, and details are not described herein again.
  • An embodiment of the present disclosure further provides a server, which includes: a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the above The method of FIG. 6 or FIG. 7 .
  • Embodiments of the present disclosure also provide an electronic device, the electronic device comprising:
  • a display which is used to display the pages of the browser or application program carried on the electronic device
  • a processor configured to execute the computer program, when the computer program is executed by the processor, the method of any of the above-mentioned embodiments in FIG. 1 to FIG. 5 can be implemented.
  • FIG. 9 is a schematic structural diagram of an electronic device in an embodiment of the present disclosure.
  • the electronic device 1000 in the embodiment of the present disclosure may include, but is not limited to, such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle-mounted terminal ( For example, mobile terminals such as car navigation terminals) and the like, and stationary terminals such as digital TVs, desktop computers, and the like.
  • the electronic device shown in FIG. 9 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.
  • an electronic device 1000 may include a processing device (eg, a central processing unit, a graphics processor, etc.) 1001, which may be loaded into random access according to a program stored in a read only memory (ROM) 1002 or from a storage device 1008 Various appropriate operations and processes are executed by the programs in the memory (RAM) 1003 . In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored.
  • the processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other through a bus 1004.
  • An input/output (I/O) interface 1005 is also connected to the bus 1004 .
  • the following devices can be connected to the I/O interface 1005: input devices 1006 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speakers, vibration An output device 1007 such as a computer; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009 .
  • the communication means 1009 may allow the electronic device 1000 to communicate wirelessly or by wire with other devices to exchange data. While FIG. 9 shows the electronic device 1000 having various means, it should be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated in the flowchart.
  • the computer program may be downloaded and installed from the network via the communication device 1009, or from the storage device 1008, or from the ROM 1002.
  • the processing apparatus 1001 the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, electrical wire, optical fiber cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
  • the client and server can use any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol) to communicate, and can communicate with digital data in any form or medium Communication (eg, a communication network) interconnects.
  • HTTP HyperText Transfer Protocol
  • Examples of communication networks include local area networks (“LAN”), wide area networks (“WAN”), the Internet (eg, the Internet), and peer-to-peer networks (eg, ad hoc peer-to-peer networks), as well as any currently known or future development network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or may exist alone without being incorporated into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device can: Loading a spliced file obtained by splicing page resources on a page, the page code includes information about the location of the page resource in the spliced file; based on the page code, read from the location of the spliced file The page resource is fetched, and the page resource is loaded on the to-be-loaded page.
  • Computer program code for performing operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and This includes conventional procedural programming languages - such as the "C" language or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server.
  • the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented in dedicated hardware-based systems that perform the specified functions or operations , or can be implemented in a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments of the present disclosure may be implemented in a software manner, and may also be implemented in a hardware manner. Among them, the name of the unit does not constitute a limitation of the unit itself under certain circumstances.
  • exemplary types of hardware logic components include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), Systems on Chips (SOCs), Complex Programmable Logical Devices (CPLDs) and more.
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs Systems on Chips
  • CPLDs Complex Programmable Logical Devices
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with the instruction execution system, apparatus or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), fiber optics, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • An embodiment of the present disclosure further provides a computer-readable storage medium, where a computer program is stored in the storage medium, and when the computer program is executed by a processor, the method of any of the foregoing embodiments in FIG. 1 to FIG. 7 can be implemented, The implementation manner and beneficial effects thereof are similar, and will not be repeated here.

Landscapes

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

Abstract

本公开实施例涉及一种页面加载方法、装置、设备及存储介质,通过从服务器上请求待加载页面的页面代码以及由待加载到待加载页面上的页面资源拼接成的拼接文件,并根据页面代码中携带的页面资源在拼接文件中的位置信息,将拼接文件中相应位置上的页面资源加载到待加载页面上,实现了页面的快速加载。由于本公开实施例可以通过拼接文件将多个页面资源一次性反馈给浏览器,因而简化了页面资源的获取流程,提高了页面的加载速度和效率。

Description

页面加载方法、装置、设备及存储介质
优先权信息
本申请要求于2021年04月14日提交的,申请名称为“页面加载方法、装置、设备及存储介质”的、中国专利申请号“202110400534.3”的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本公开实施例涉及计算机技术领域,尤其涉及一种页面加载方法、装置、设备及存储介质。
背景技术
相关技术中在打开浏览器或应用程序的页面时,通常需要从服务器上下载页面上的资源(比如,图片、文字、音频、视频等),然后再将页面资源加载到页面上。页面资源的下载速度直接影响页面的打开速度,因此,如何提高页面资源的下载速度,也是本领域技术人员需要解决的问题。
发明内容
为了解决上述技术问题或者至少部分地解决上述技术问题,本公开实施例提供了一种页面加载方法、装置、设备及存储介质。
本公开实施例的第一方面提供了一种页面加载方法,该方法包括:从服务器上请求得到待加载页面的页面代码,以及由待加载到待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息;基于所述页面代码,从所述拼接文件的所述位置上读取所述页面资源,并将所述页面资源加载到所述待加载页面上。
在一种实施方式中,所述拼接文件由至少两种格式的页面资源拼接得到。
在一种实施方式中,所述从服务器上请求得到待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,包括:
基于待加载页面的地址,向所述服务器请求得到所述待加载页面的页面代码,所述页面代码中还包括所述拼接文件的标识;基于所述标识,向所述服务器请求得到所述拼接文件。
在一种实施方式中,所述从服务器上请求得到待加载页面的页面代码,以及由待 加载到所述待加载页面上的页面资源拼接得到的拼接文件,包括:
向服务器发送下载请求,所述下载请求中包括待加载页面的地址;接收所述服务器根据所述地址反馈的所述待加载页面的页面代码和所述拼接文件。
在一种实施方式中,所述页面资源在所述拼接文件中的位置的信息包括所述页面资源的起始位置和数据大小的信息;
所述基于所述页面代码,从所述拼接文件的所述位置上读取所述页面资源,包括:
从所述页面代码中读取得到所述起始位置和所述数据大小的信息;根据所述起始位置和所述数据大小的信息,确定所述页面资源在所述拼接文件中的结束位置;基于所述起始位置和所述结束位置,从所述拼接文件中读取得到所述页面资源。
本公开实施例的第二方面提供了一种页面加载方法,该方法包括:
接收浏览器发送的第一获取请求,所述第一获取请求包括待加载页面的地址;基于所述地址,将所述待加载页面的页面代码反馈给所述浏览器,所述页面代码中包括待加载到所述待加载页面上的页面资源所在的拼接文件的标识,以及所述页面资源在所述拼接文件中的位置的信息;接收所述浏览器发送的第二获取请求,所述第二获取请求中包括所述拼接文件的标识;根据所述标识,将所述拼接文件反馈给所述浏览器,以使所述浏览器基于所述页面代码和所述拼接文件,将所述页面资源加载到所述待加载页面上。
本公开实施例的第三方面提供了一种页面加载方法,该方法包括:
接收浏览器发送的下载请求,所述下载请求中包括待加载页面的地址;根据所述地址,向所述浏览器反馈所述待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息,以使所述浏览器根据所述页面代码和所述拼接文件,将所述页面资源加载到所述待加载页面上。
本公开实施例的第四方面提供了一种页面加载装置,该装置包括:
请求模块,用于从服务器上请求得到待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息;
加载模块,用于基于所述页面代码,从所述拼接文件的所述位置上读取所述页面资源,并将所述页面资源加载到所述待加载页面上。
在一种实施方式中,所述拼接文件由至少两种格式的页面资源拼接得到。
在一种实施方式中,所述请求模块,包括:
第一请求子模块,用于基于待加载页面的地址,向所述服务器请求得到所述待加 载页面的页面代码,所述页面代码中还包括所述拼接文件的标识;
第二请求子模块,用于基于所述标识,向所述服务器请求得到所述拼接文件。
在一种实施方式中,所述请求模块,包括:
第三请求子模块,用于向服务器发送下载请求,所述下载请求中包括待加载页面的地址;
接收子模块,用于接收所述服务器根据所述地址反馈的所述待加载页面的页面代码和所述拼接文件。
在一种实施方式中,所述页面资源在所述拼接文件中的位置的信息包括所述页面资源的起始位置和数据大小的信息;
所述加载模块,用于:
从所述页面代码中读取得到所述起始位置和所述数据大小的信息;
根据所述起始位置和所述数据大小的信息,确定所述页面资源在所述拼接文件中的结束位置;
基于所述起始位置和所述结束位置,从所述拼接文件中读取得到所述页面资源。
本公开实施例的第五方面提供了一种页面加载装置,该装置包括:
第一接收模块,用于接收浏览器发送的第一获取请求,所述第一获取请求包括待加载页面的地址;
第一反馈模块,用于基于所述地址,将所述待加载页面的页面代码反馈给所述浏览器,所述页面代码中包括待加载到所述待加载页面上的页面资源所在的拼接文件的标识,以及所述页面资源在所述拼接文件中的位置的信息;
第二接收模块,用于接收所述浏览器发送的第二获取请求,所述第二获取请求中包括所述拼接文件的标识;
第二反馈模块,用于根据所述标识,将所述拼接文件反馈给所述浏览器,以使所述浏览器基于所述页面代码和所述拼接文件,将所述页面资源加载到所述待加载页面上。
本公开实施例的第六方面提供了一种页面加载装置,该装置包括:
接收模块,用于接收浏览器发送的下载请求,所述下载请求中包括待加载页面的地址;
反馈模块,用于根据所述地址,向所述浏览器反馈所述待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息,以使所述浏览器根据所述页面代码和所述拼接文件,将所述页面资源加载到所述待加载页面上。
本公开实施例的第七方面提供了一种电子设备,该电子设备,包括:
显示器,用于对所述电子设备上搭载的浏览器或应用程序的页面进行显示;
存储器,所述存储器中存储有计算机程序;
处理器,用于执行所述计算机程序,当所述计算机程序被所述处理器执行时,所述处理器执行上述第一方面的方法。
本公开实施例的第八方面提供了一种服务器,该服务器包括:处理器和存储器,其中,所述存储器中存储有计算机程序,当所述计算机程序被所述处理器执行时,所述处理器执行上述第二方面或第三方面的方法。
本公开实施例的第九方面提供了一种计算机可读存储介质,该存储介质中存储有计算机程序,当该计算机程序被处理器执行时,可以实现上述第一至第三方面中任一方面的方法。
本公开实施例提供的技术方案与现有技术相比具有如下优点:
本公开实施例,通过从服务器上请求待加载页面的页面代码以及由待加载到待加载页面上的页面资源拼接成的拼接文件,并根据页面代码中携带的页面资源在拼接文件中的位置信息,将拼接文件中相应位置上的页面资源加载到待加载页面上,实现了页面的快速加载。由于本公开实施例可以通过拼接文件将多个页面资源一次性反馈给浏览器,因而简化了页面资源的获取流程,提高了页面的加载速度和效率。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本公开实施例提供的一种页面加载方法的流程图;
图2和图3是本公开实施例提供的一种获取页面代码和页面资源的方法的示意图;
图4是本公开实施例提供的又一种获取页面代码和页面资源的方法的示意图;
图5是本公开实施例提供的一种页面加载方法的流程图;
图6是本公开实施例提供的一种页面加载方法的流程图;
图7是本公开实施例提供的一种页面加载方法的流程图;
图8是本公开实施例提供的一种页面加载装置的结构示意图;
图9是本公开实施例中的一种电子设备的结构示意图。
具体实施方式
为了能够更清楚地理解本公开的上述目的、特征和优点,下面将对本公开的方案进行进一步描述。需要说明的是,在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合。
在下面的描述中阐述了很多具体细节以便于充分理解本公开,但本公开还可以采用其他不同于在此描述的方式来实施;显然,说明书中的实施例只是本公开的一部分实施例,而不是全部的实施例。
图1是本公开实施例提供的一种页面加载方法的流程图,该方法可以由一种电子设备来执行。该电子设备可以示例性的理解为诸如手机、平板电脑、笔记本电脑、台式机、智能电视等具有页面展示功能的设备。如图1所示,本实施例提供的方法包括如下步骤:
步骤101、从服务器上请求得到待加载页面的页面代码,以及由待加载到待加载页面上的页面资源拼接得到的拼接文件,页面代码中包括待加载页面上的页面资源在拼接文件中的位置的信息。
步骤102、基于待加载页面的页面代码,从拼接文件的相应位置上读取待加载页面的页面资源,并将读取到的页面资源加载到该待加载页面上。
本实施例中的拼接文件可以由多个页面资源拼接得到,拼接方式比如可以是首尾相连,但不局限于首尾相连。构成拼接文件的多个页面资源可以是某个页面上的全部页面资源,也可以是某个页面上的部分页面资源。其中,构成拼接文件的多个页面资源的格式可以相同也可以不同,也就是说在一种实施方式中拼接文件可由至少两种格式的页面资源拼接得到。
本实施例中的待加载页面可以示例性的理解为超文本标记语言(Hyper Text Markup Language,简称HTML)页面。本实施例中的页面代码可以示例性的理解为以HTML语言编写的代码。该页面代码至少以HTML语言描述了页面上诸如图片、视频、音频、文字等页面资源的信息。页面资源的信息比如可以是页面资源的名称、格式、页面资源在拼接文件中的位置中的至少一种。
可选的,在本实施例中电子设备通过发送请求消息的方式向服务器请求待加载页面的页面代码和包含待加载页面的页面资源的拼接文件,拼接文件的个数可以是一个也可以是多个。其中,电子设备请求页面代码和拼接文件的方式至少包括如下几种:
在一种实现方式中,电子设备可以通过一次下载请求同时获得待加载页面的页面代码和拼接文件。示例的,图2和图3是本公开实施例提供的一种获取页面代码和页面资源的方法的示意图,如图2所示,在这种方式中,电子设备21可以将待加载页面的地址携带在 下载请求中发送给服务器22,服务器22在接收到该下载请求后,默认根据下载请求中的地址,将待加载页面的页面代码和拼接文件反馈给电子设备21;或者,如图3所示,电子设备21也可以同时将待加载页面的地址和自身的性能信息,比如支持的浏览器的类型、版本、网速等,携带在下载请求中发送给服务器22,服务器22在接收到下载请求之后,根据下载请求中的性能信息确定以何种方式反馈待加载页面的页面资源,若下载请求中的性能信息符合预设条件(比如,浏览器的类型和版本均符合预设的浏览器类型和版本),则将包含待加载页面的页面资源的拼接文件和页面代码反馈给电子设备21。如果下载请求中的性能信息不符合预设条件,则以其它预定的方式(比如将页面资源进行打包压缩或者将页面中的图片合成一张图片等,但不局限于这里列举的方式)将待加载页面的页面代码和拼接文件反馈给电子设备21。电子设备21在接收到待加载页面的页面代码和拼接文件后,根据页面代码中记录的各页面资源在拼接文件中的位置,将拼接文件中相应位置上的页面资源加载到页面上。
在另一种实现方式中,电子设备可以通过两次请求分别获得待加载页面的页面代码和拼接文件。示例的,图4是本公开实施例提供的又一种获取页面代码和页面资源的方法的示意图,如图4所示,在这种方式中,在第一次请求中电子设备41可以将待加载页面的地址携带在请求消息中发送给服务器42,并接收服务器42根据请求消息反馈的页面代码,该页面代码中除了包括页面上各页面资源的名称、格式,以及页面资源在拼接文件中的位置信息以外,还包括各页面资源所在的拼接文件的标识。电子设备41在接收到服务器42反馈的页面代码之后,根据页面代码中的拼接文件的标识,从服务器42中请求得到相应的拼接文件,并根据页面代码上记录的各页面资源在拼接文件中的位置,将相应位置上的页面资源加载到页面上,从而完成对页面的加载。需要说明的是,在这种实现方式中待加载页面上的多个页面资源可以被分散在多个拼接文件中,页面代码中不同页面资源对应的拼接文件的标识也可能不同。
当然上述两种实现方式仅是用来进行示例说明的方式而不是本实施例的全部方式,实际上,电子设备向服务器请求页面代码和拼接文件的具体方式可以根据需要进行配置,而不必局限于一种或几种特定的方式。
本公开实施例,通过从服务器上请求待加载页面的页面代码以及由待加载到待加载页面上的页面资源拼接成的拼接文件,并根据页面代码中携带的页面资源在拼接文件中的位置信息,将拼接文件中相应位置上的页面资源加载到待加载页面上,实现了页面的快速加载。由于本公开实施例可以通过拼接文件将多个页面资源一次性反馈给浏览器,因而简化了页面资源的获取流程,提高了页面的加载速度和效率。并且该拼接文件中可以包括多种格式的页面资源,对页面资源的格式、数据大小没有限制,支持动图和非图片资源。
图5是本公开实施例提供的一种页面加载方法的流程图,如图5所示,本实施例提供的方法包括:
步骤501、从服务器上请求得到待加载页面的页面代码,以及由待加载到待加载页面上的页面资源拼接得到的拼接文件,页面代码中包括待加载页面上的页面资源在拼接文件中的起始位置和数据大小的信息。
步骤502、从页面代码中读取得到页面资源在拼接文件中的起始位置和数据大小的信息。
步骤503、根据页面资源的起始位置和数据大小的信息,确定页面资源在拼接文件中的结束位置。
步骤504、基于页面资源的起始位置和结束位置,从拼接文件中读取得到页面资源,并将页面资源加载到待加载页面上。
举例来说,下面一段代码为某个待加载页面的页面代码:
<html><body>
<img src="1.jpeg"multi-src="all;0;2000">
<img src="2.webp"multi-src="all;2000;1000">
<script src="3.js"multi-src="all;3000;500"></script>
</body></html>
其中,页面代码中的“<img src="1.jpeg"multi-src="all;0;2000">",表示从网络上获取一个文件格式为“.jpeg”,文件名称为“1”的图片插入页面,该图片在名称为“all”的拼接文件中,该图片在拼接文件中的起始位置的地址为“0”,数据大小为“2000”。页面代码中的“<img src="2.webp"multi-src="all;2000;1000">",表示从网络上获取一个文件格式为“.webp”,文件名称为“2”的图片插入页面,该图片在名称为“all”的拼接文件中,该图片在拼接文件中的起始位置的地址为“2000”,数据大小为“1000”。页面代码中的“<script src="3.js"multi-src="all;3000;500"></script>",表示从网络上获取一个名为“3.js”的客户端脚本,该脚本在名称为“all”的拼接文件中,该图片在拼接文件中的起始位置的地址为“3000”,数据大小为“500”。
那么根据图片"1.jpeg"的起始位置的地址“0”和数据大小“2000”,可以得到图片"1.jpeg"在拼接文件中的结束位置的地址是“1999”;根据图片"2.webp"的起始位置的地址“2000”和数据大小“1000”,可以得到图片"2.webp"在拼接文件中的结束位置的地址是“2999”;根据客户端脚本"3.js"的起始位置的地址“3000”和数据大小“500”,可以得到客户端脚本"3.js"在拼接文件中的结束位置的地址是“3499”。从而根据图片"1.jpeg"、图片"2.webp"以及客户端脚本"3.js"在拼接文件中的起始位置的地址和结束位置的地址,可以将"1.jpeg"、 "2.webp"和"3.js"加载到待加载页面上。
当然上述仅为示例说明而不是对页面代码的唯一限定。
值得说明的是虽然本实施例仅提供了一种从拼接文件中加载页面资源的方法,但是该方法并不是本公开的唯一方法,实际上,在一些实施方式中,上述页面代码中用于表示页面资源的数据大小的字段,还可以被替换为用于表示页面资源在拼接文件中结束位置的地址的字段。也就是说在这种情况下,页面资源在拼接文件中的位置可以用页面资源在拼接文件中的起始位置和结束位置表示。
本实施例通过在页面代码中携带页面资源在拼接文件中的起始位置和数据大小,能够帮着电子设备快速准确的确定页面在拼接文件中位置,从而为实现快速页面加载提供了保证。
图6是本公开实施例提供的一种页面加载方法的流程图,该方法可以由一种服务器来执行。如图6所示,该方法包括:
步骤601、接收电子设备上的浏览器发送的第一获取请求,第一获取请求包括待加载页面的地址。
步骤602、基于待加载页面的地址,将待加载页面的页面代码反馈给浏览器,页面代码中包括待加载到待加载页面上的页面资源所在的拼接文件的标识,以及该些页面资源在拼接文件中的位置的信息。
步骤603、接收浏览器发送的第二获取请求,第二获取请求中包括拼接文件的标识。
步骤604、根据拼接文件的标识,将对应的拼接文件反馈给浏览器,以使浏览器基于接收到的页面代码和拼接文件,将页面资源加载到待加载页面上。
本实施例的实施方式和有益效果可以参见图1实施例中的相关内容在这里不再赘述。
图7是本公开实施例提供的一种页面加载方法的流程图,该方法可以由一种服务器来执行。如图7所示,该方法包括:
步骤701、接收电子设备上的浏览器发送的下载请求,下载请求中包括待加载页面的地址。
步骤702、根据待加载页面的地址,向浏览器反馈待加载页面的页面代码,以及由待加载到待加载页面上的页面资源拼接得到的拼接文件,页面代码中包括页面资源在拼接文件中的位置的信息,以使浏览器根据接收到的页面代码和拼接文件,将页面资源加载到待加载页面上。
本实施例的实施方式和有益效果可以参见图1实施例中的相关内容在这里不再赘述。
图8是本公开实施例提供的一种页面加载装置的结构示意图,该页面加载装置可以被理解为上述电子设备或者上述电子设备中的部分功能模块。如图8所示,该页面加载装置 80包括:
请求模块81,用于从服务器上请求得到待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息;
加载模块82,用于基于所述页面代码,从所述拼接文件的所述位置上读取所述页面资源,并将所述页面资源加载到所述待加载页面上。
在一种实施方式中,所述拼接文件由至少两种格式的页面资源拼接得到。
在一种实施方式中,所述请求模块81,包括:
第一请求子模块,用于基于待加载页面的地址,向所述服务器请求得到所述待加载页面的页面代码,所述页面代码中还包括所述拼接文件的标识;
第二请求子模块,用于基于所述标识,向所述服务器请求得到所述拼接文件。
在一种实施方式中,所述请求模块81,包括:
第三请求子模块,用于向服务器发送下载请求,所述下载请求中包括待加载页面的地址;
接收子模块,用于接收所述服务器根据所述地址反馈的所述待加载页面的页面代码和所述拼接文件。
在一种实施方式中,所述页面资源在所述拼接文件中的位置的信息包括所述页面资源的起始位置和数据大小的信息;
所述加载模块82,用于:
从所述页面代码中读取得到所述起始位置和所述数据大小的信息;
根据所述起始位置和所述数据大小的信息,确定所述页面资源在所述拼接文件中的结束位置;
基于所述起始位置和所述结束位置,从所述拼接文件中读取得到所述页面资源。
本实施例提供的装置能够执行上述图1-图5中任一实施例的方法,其执行方式和有益效果类似,在这里不再赘述。
本公开还提供了一种页面加载装置,该页面加载装置可以理解为上述实施例中的服务器或者服务器中的部分功能模块。在一个实施例中,该页面加载装置可以包括:
第一接收模块,用于接收浏览器发送的第一获取请求,所述第一获取请求包括待加载页面的地址;
第一反馈模块,用于基于所述地址,将所述待加载页面的页面代码反馈给所述浏览器,所述页面代码中包括待加载到所述待加载页面上的页面资源所在的拼接文件的标识,以及所述页面资源在所述拼接文件中的位置的信息;
第二接收模块,用于接收所述浏览器发送的第二获取请求,所述第二获取请求中包括所述拼接文件的标识;
第二反馈模块,用于根据所述标识,将所述拼接文件反馈给所述浏览器,以使所述浏览器基于所述页面代码和所述拼接文件,将所述页面资源加载到所述待加载页面上。
在另一个实施例中,该页面加载装置可以包括:
接收模块,用于接收浏览器发送的下载请求,所述下载请求中包括待加载页面的地址;
反馈模块,用于根据所述地址,向所述浏览器反馈所述待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息,以使所述浏览器根据所述页面代码和所述拼接文件,将所述页面资源加载到所述待加载页面上。
本实施例提供的装置能够执行图6或图7实施例的方法,其执行方式和有益效果类似,在这里不再赘述。
本公开实施例还提供了一种服务器,该服务器包括:处理器和存储器,其中,所述存储器中存储有计算机程序,当所述计算机程序被所述处理器执行时,所述处理器执行上述图6或图7的方法。
本公开实施例还提供了一种电子设备,该电子设备包括:
显示器,用于对电子设备上搭载的浏览器或应用程序的页面进行显示;
存储器,存储器中存储有计算机程序;
处理器,用于执行所述计算机程序,当所述计算机程序被所述处理器执行时可以实现上述图1-图5中任一实施例的方法。
示例的,图9是本公开实施例中的一种电子设备的结构示意图。下面具体参考图9,其示出了适于用来实现本公开实施例中的电子设备1000的结构示意图。本公开实施例中的电子设备1000可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图9示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图9所示,电子设备1000可以包括处理装置(例如中央处理器、图形处理器等)1001,其可以根据存储在只读存储器(ROM)1002中的程序或者从存储装置1008加载到随机访问存储器(RAM)1003中的程序而执行各种适当的动作和处理。在RAM 1003中,还存储有电子设备1000操作所需的各种程序和数据。处理装置1001、ROM 1002以及RAM 1003通过总线1004彼此相连。输入/输出(I/O)接口1005也连接至总线1004。
通常,以下装置可以连接至I/O接口1005:包括例如触摸屏、触摸板、键盘、鼠标、 摄像头、麦克风、加速度计、陀螺仪等的输入装置1006;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置1007;包括例如磁带、硬盘等的存储装置1008;以及通信装置1009。通信装置1009可以允许电子设备1000与其他设备进行无线或有线通信以交换数据。虽然图9示出了具有各种装置的电子设备1000,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置1009从网络上被下载和安装,或者从存储装置1008被安装,或者从ROM 1002被安装。在该计算机程序被处理装置1001执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配 入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:从服务器上请求得到待加载页面的页面代码,以及由待加载到待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息;基于所述页面代码,从所述拼接文件的所述位置上读取所述页面资源,并将所述页面资源加载到所述待加载页面上。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子 的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
本公开实施例还提供一种计算机可读存储介质,所述存储介质中存储有计算机程序,当所述计算机程序被处理器执行时可以实现上述图1-图7中任一实施例的方法,其执行方式和有益效果类似,在这里不再赘述。
需要说明的是,在本文中,诸如“第一”和“第二”等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上所述仅是本公开的具体实施方式,使本领域技术人员能够理解或实现本公开。对这些实施例的多种修改对本领域的技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本公开的精神或范围的情况下,在其它实施例中实现。因此,本公开将不会被限制于本文所述的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。

Claims (17)

  1. 一种页面加载方法,其特征在于,包括:
    从服务器上请求得到待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息;
    基于所述页面代码,从所述拼接文件的所述位置上读取所述页面资源,并将所述页面资源加载到所述待加载页面上。
  2. 根据权利要求1所述的方法,其特征在于,所述拼接文件由至少两种格式的页面资源拼接得到。
  3. 根据权利要求1所述的方法,其特征在于,所述从服务器上请求得到待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,包括:
    基于待加载页面的地址,向所述服务器请求得到所述待加载页面的页面代码,所述页面代码中还包括所述拼接文件的标识;
    基于所述标识,向所述服务器请求得到所述拼接文件。
  4. 根据权利要求1所述的方法,其特征在于,所述从服务器上请求得到待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,包括:
    向服务器发送下载请求,所述下载请求中包括待加载页面的地址;
    接收所述服务器根据所述地址反馈的所述待加载页面的页面代码和所述拼接文件。
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述页面资源在所述拼接文件中的位置的信息包括所述页面资源的起始位置和数据大小的信息;
    所述基于所述页面代码,从所述拼接文件的所述位置上读取所述页面资源,包括:
    从所述页面代码中读取得到所述起始位置和所述数据大小的信息;
    根据所述起始位置和所述数据大小的信息,确定所述页面资源在所述拼接文件中的结束位置;
    基于所述起始位置和所述结束位置,从所述拼接文件中读取得到所述页面资源。
  6. 一种页面加载方法,其特征在于,包括:
    接收浏览器发送的第一获取请求,所述第一获取请求包括待加载页面的地址;
    基于所述地址,将所述待加载页面的页面代码反馈给所述浏览器,所述页面代码中包括待加载到所述待加载页面上的页面资源所在的拼接文件的标识,以及所述页面资源在所述拼接文件中的位置的信息;
    接收所述浏览器发送的第二获取请求,所述第二获取请求中包括所述拼接文件的标识;
    根据所述标识,将所述拼接文件反馈给所述浏览器,以使所述浏览器基于所述页面代码和所述拼接文件,将所述页面资源加载到所述待加载页面上。
  7. 一种页面加载方法,其特征在于,包括:
    接收浏览器发送的下载请求,所述下载请求中包括待加载页面的地址;
    根据所述地址,向所述浏览器反馈所述待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息,以使所述浏览器根据所述页面代码和所述拼接文件,将所述页面资源加载到所述待加载页面上。
  8. 一种页面加载装置,其特征在于,包括:
    请求模块,用于从服务器上请求得到待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息;
    加载模块,用于基于所述页面代码,从所述拼接文件的所述位置上读取所述页面资源,并将所述页面资源加载到所述待加载页面上。
  9. 根据权利要求8所述的装置,其特征在于,所述拼接文件由至少两种格式的页面资源拼接得到。
  10. 根据权利要求8所述的装置,其特征在于,所述请求模块,包括:
    第一请求子模块,用于基于待加载页面的地址,向所述服务器请求得到所述待加载页面的页面代码,所述页面代码中还包括所述拼接文件的标识;
    第二请求子模块,用于基于所述标识,向所述服务器请求得到所述拼接文件。
  11. 根据权利要求8所述的装置,其特征在于,所述请求模块,包括:
    第三请求子模块,用于向服务器发送下载请求,所述下载请求中包括待加载页面的地址;
    接收子模块,用于接收所述服务器根据所述地址反馈的所述待加载页面的页面代码和所述拼接文件。
  12. 根据权利要求8-11中任一项所述的装置,其特征在于,所述页面资源在所述拼接文件中的位置的信息包括所述页面资源的起始位置和数据大小的信息;
    所述加载模块,用于:
    从所述页面代码中读取得到所述起始位置和所述数据大小的信息;
    根据所述起始位置和所述数据大小的信息,确定所述页面资源在所述拼接文件中的结束位置;
    基于所述起始位置和所述结束位置,从所述拼接文件中读取得到所述页面资源。
  13. 一种页面加载装置,其特征在于,包括:
    第一接收模块,用于接收浏览器发送的第一获取请求,所述第一获取请求包括待加载 页面的地址;
    第一反馈模块,用于基于所述地址,将所述待加载页面的页面代码反馈给所述浏览器,所述页面代码中包括待加载到所述待加载页面上的页面资源所在的拼接文件的标识,以及所述页面资源在所述拼接文件中的位置的信息;
    第二接收模块,用于接收所述浏览器发送的第二获取请求,所述第二获取请求中包括所述拼接文件的标识;
    第二反馈模块,用于根据所述标识,将所述拼接文件反馈给所述浏览器,以使所述浏览器基于所述页面代码和所述拼接文件,将所述页面资源加载到所述待加载页面上。
  14. 一种页面加载装置,其特征在于,包括:
    接收模块,用于接收浏览器发送的下载请求,所述下载请求中包括待加载页面的地址;
    反馈模块,用于根据所述地址,向所述浏览器反馈所述待加载页面的页面代码,以及由待加载到所述待加载页面上的页面资源拼接得到的拼接文件,所述页面代码中包括所述页面资源在所述拼接文件中的位置的信息,以使所述浏览器根据所述页面代码和所述拼接文件,将所述页面资源加载到所述待加载页面上。
  15. 一种电子设备,其特征在于,包括:
    显示器,用于对所述电子设备上搭载的浏览器或应用程序的页面进行显示;
    存储器,所述存储器中存储有计算机程序;
    处理器,用于执行所述计算机程序,当所述计算机程序被所述处理器执行时,所述处理器执行如权利要求1-5中任一项所述的方法。
  16. 一种服务器,其特征在于,包括:
    处理器和存储器,其中,所述存储器中存储有计算机程序,当所述计算机程序被所述处理器执行时,所述处理器执行权利要求6或7所述的方法。
  17. 一种计算机可读存储介质,其特征在于,所述存储介质中存储有计算机程序,当所述计算机程序被处理器执行时,实现如权利要求1-7中任一项所述的方法。
PCT/CN2022/076356 2021-04-14 2022-02-15 页面加载方法、装置、设备及存储介质 WO2022218028A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110400534.3 2021-04-14
CN202110400534.3A CN113010821A (zh) 2021-04-14 2021-04-14 页面加载方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2022218028A1 true WO2022218028A1 (zh) 2022-10-20

Family

ID=76389424

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/076356 WO2022218028A1 (zh) 2021-04-14 2022-02-15 页面加载方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN113010821A (zh)
WO (1) WO2022218028A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113010821A (zh) * 2021-04-14 2021-06-22 北京字节跳动网络技术有限公司 页面加载方法、装置、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110239108A1 (en) * 2010-03-26 2011-09-29 Microsoft Corporation Configurable dynamic combination of html resources for download optimization in script based web page
WO2017206417A1 (zh) * 2016-05-31 2017-12-07 乐视控股(北京)有限公司 页面资源加载方法、装置和系统
CN112347404A (zh) * 2020-10-26 2021-02-09 长沙市到家悠享网络科技有限公司 Spa页面渲染方法、设备、系统及存储介质
CN113010821A (zh) * 2021-04-14 2021-06-22 北京字节跳动网络技术有限公司 页面加载方法、装置、设备及存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9049246B2 (en) * 2012-02-28 2015-06-02 Red Hat, Inc. Reducing web page loading time
US20170011133A1 (en) * 2014-03-31 2017-01-12 Open Garden Inc. System and method for improving webpage loading speeds
CN107291759B (zh) * 2016-04-01 2020-08-11 腾讯科技(深圳)有限公司 浏览器页面资源的处理方法和装置
CN107800748A (zh) * 2016-09-07 2018-03-13 广州市动景计算机科技有限公司 页面资源获取和发放方法、装置、设备和系统
CN108415963A (zh) * 2018-02-07 2018-08-17 阿里巴巴集团控股有限公司 一种页面生成方法和装置
CN109710870A (zh) * 2018-12-27 2019-05-03 北京微播视界科技有限公司 H5页面的加载方法、装置、电子设备及可读存储介质
CN111639278B (zh) * 2020-05-26 2024-03-08 北京三快在线科技有限公司 一种网页加载方法及装置
CN112612977A (zh) * 2020-12-15 2021-04-06 京东数字科技控股股份有限公司 一种页面显示方法、系统、装置、设备及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110239108A1 (en) * 2010-03-26 2011-09-29 Microsoft Corporation Configurable dynamic combination of html resources for download optimization in script based web page
WO2017206417A1 (zh) * 2016-05-31 2017-12-07 乐视控股(北京)有限公司 页面资源加载方法、装置和系统
CN112347404A (zh) * 2020-10-26 2021-02-09 长沙市到家悠享网络科技有限公司 Spa页面渲染方法、设备、系统及存储介质
CN113010821A (zh) * 2021-04-14 2021-06-22 北京字节跳动网络技术有限公司 页面加载方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN113010821A (zh) 2021-06-22

Similar Documents

Publication Publication Date Title
CN111581563B (zh) 页面响应方法、装置、存储介质和电子设备
CN111930534A (zh) 数据调用方法、装置和电子设备
CN114205664B (zh) 投屏方法、投屏装置、投屏显示装置、投屏系统及介质
WO2021082693A1 (zh) 网页图像加载时长的获取方法、装置及电子设备
CN112269959B (zh) 展示内容的控制方法、装置、可读介质和电子设备
CN112965673A (zh) 内容的打印方法、装置、设备及存储介质
WO2022218028A1 (zh) 页面加载方法、装置、设备及存储介质
CN113761097B (zh) 用于浏览器端的地图瓦片加载方法、装置、设备和介质
CN111355784B (zh) 一种处理请求信息的方法、装置、介质和电子设备
CN111756953A (zh) 视频处理方法、装置、设备和计算机可读介质
CN111352872A (zh) 执行引擎、数据处理方法、装置、电子设备和介质
WO2022206254A1 (zh) so文件的修复方法、装置、设备及存储介质
CN112084441A (zh) 信息检索方法、装置和电子设备
CN113126985B (zh) 用于页面渲染的方法、装置、电子设备和计算机可读介质
CN111581556B (zh) 页面数据处理方法、装置、电子设备和可读介质
CN111444457B (zh) 数据发布方法、装置、存储介质及电子设备
CN112732457B (zh) 图像传输方法、装置、电子设备和计算机可读介质
CN111596823B (zh) 页面显示方法、装置和电子设备
WO2021082599A1 (zh) 网页图像的监控方法、装置、电子设备及计算机可读存储介质
CN110730251B (zh) 一种解析域名的方法、装置、介质和电子设备
CN111538552A (zh) 礼物面板配置方法、装置、可读介质及电子设备
CN113157365B (zh) 程序运行方法、装置、电子设备和计算机可读介质
CN112948108B (zh) 请求处理方法、装置和电子设备
CN117880608A (zh) 数据处理方法、装置、可读介质及电子设备
CN110099122B (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: 22787258

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 120224)