Speeding up document loading
Methods, systems, and apparatus, including computer programs encoded on a computer storage medium, for speeding up document loading. In some implementations, a resource of a document is requested from a first source, and metadata for the document is requested from a second source that is different from the first source. The requested metadata is received from the second source, and the requested resource is received from the first source. A first representation of the document based on the received metadata is provided for display. After providing the first representation, a second representation of the document that combines portions of the first representation with additional portions of the document is generated, and the second representation is provided for display.
1 . A method comprising:
receiving a single request for a web page; and
in response to receiving the single request for the web page, delivering metadata for a layout of the web page from a first source separate from delivering resources from a second source for rendering in the web page according to the metadata of the layout without updating the layout when the resources are rendered, the first source being from a different domain than the second source,
wherein the metadata indicates a location of a fold of the web page, and identifies content for display in an above-the-fold region of the web page based on the location of the fold to enable prioritization of processing of the content identified for display in the above-the-fold region before processing content for display outside the above-the-fold region.
2 . The method of claim 1 , further comprising:
causing a first representation of the web page to be rendered using the resources and the metadata.
3 . The method of claim 2 , further comprising:
generating a second representation of the web page that combines additional resources with the first representation of the web page; and
causing the second representation of the web page to be rendered.
4 . The method of claim 1 , wherein the metadata for the layout of the web page includes style information for at least a portion of the resources.
5 . The method of claim 1 , wherein the metadata for the layout of the web page includes at least a portion of cascading style sheets (CSS).
6 . The method of claim 1 , wherein the metadata for the layout of the web page includes size information and position information for at least a portion of the resources.
7 . The method of claim 6 , wherein the size information and the position information include the size information and the position information as indicated for after execution of scripts in the web page.
8 . The method of claim 1 , wherein delivering the metadata for the layout of the web page from the first source separate from delivering the resources from the second source for rendering in the web page includes delivering the metadata for the layout of the web page directly from the first source separate from delivering the resources directly from the second source.
9 . A system comprising:
one or more computers; and
one or more computer-readable media storing instructions that are operable, when executed by the one or more computers, to cause the one or more computers to perform operations comprising:
receiving a single request for a web page; and
in response to receiving the single request for the web page, delivering metadata for a layout of the web page from a first source separate from delivering resources from a second source for rendering in the web page according to the metadata of the layout without updating the layout when the resources are rendered, the first source being from a different domain than the second source,
wherein the metadata indicates a location of a fold of the web page, and identifies content for display in an above-the-fold region of the web page based on the location of the fold to enable prioritization of processing of the content identified for display in the above-the-fold region before processing content for display outside the above-the-fold region.
10 . The system of claim 9 , comprising further instructions that are operable, when executed by the one or more computers, to cause the one or more computers to perform operations comprising:
causing a first representation of the web page to be rendered using the resources and the metadata.
11 . The system of claim 10 , comprising further instructions that are operable, when executed by the one or more computers, to cause the one or more computers to perform operations comprising:
generating a second representation of the web page that combines additional resources with the first representation of the web page; and
causing the second representation of the web page to be rendered.
12 . The system of claim 9 , wherein the metadata for the layout of the web page includes style information for at least a portion of the resources.
13 . The system of claim 9 , wherein the metadata for the layout of the web page includes at least a portion of cascading style sheets (CSS).
14 . The system of claim 9 , wherein the metadata for the layout of the web page includes size information and position information for at least a portion of the resources.
15 . The system of claim 14 , wherein the size information and the position information include the size information and the position information as indicated for after execution of scripts in the web page.
16 . The system of claim 9 , wherein delivering the metadata for the layout of the web page from the first source separate from delivering the resources from the second source for rendering in the web page includes instructions that are operable, when executed by the one or more computers, to cause the one or more computers to perform operations comprising delivering the metadata for the layout of the web page directly from the first source separate from delivering the resources directly from the second source.
17 . A computer program product tangibly embodied in a non-transitory storage medium, the computer program product including instructions that when executed by a processor cause the processor to perform operations, the operations comprising:
receiving a single request for a web page; and
in response to receiving the single request for the web page, delivering metadata for a layout of the web page from a first source separate from delivering resources from a second source for rendering in the web page according to the metadata of the layout without updating the layout when the resources are rendered, the first source being from a different domain than the second source,
wherein the metadata indicates a location of a fold of the web page, and identifies content for display in an above-the-fold region of the web page based on the location of the fold to enable prioritization of processing of the content identified for display in the above-the-fold region before processing content for display outside the above-the-fold region.
18 . The computer program product of claim 17 , comprising further instructions that when executed by the processor cause the processor to perform operations, the operations comprising:
causing a first representation of the web page to be rendered using the resources and the metadata.
19 . The computer program product of claim 18 , comprising further instructions that when executed by the processor cause the processor to perform operations, the operations comprising:
generating a second representation of the web page that combines additional resources with the first representation of the web page; and
causing the second representation of the web page to be rendered.
20 . The computer program product of claim 17 , wherein the metadata for the layout of the web page includes style information for at least a portion of the resources.
21 . The computer program product of claim 17 , wherein the metadata for the layout of the web page includes at least a portion of cascading style sheets (CSS).
22 . The computer program product of claim 17 , wherein the metadata for the layout of the web page includes size information and position information for at least a portion of the resources.
23 . The computer program product of claim 22 , wherein the size information and the position information include the size information and the position information as indicated for after execution of scripts in the web page.
24 . The computer program product of claim 17 , wherein delivering the metadata for the layout of the web page from the first source separate from delivering the resources from the second source for rendering in the web page includes instructions that when executed by the processor cause the processor to perform operations, the operations comprising delivering the metadata for the layout of the web page directly from the first source separate from delivering the resources directly from the second source.