Webpage image monitoring method and apparatus, electronic device, and computer-readable storage medium
AssigneeBeijing Bytedance Network Technology Co., Ltd.
InventorGuohui Yin
Life of this patent
Estimating the term…
Abstract
Provided are a webpage image monitoring method and apparatus, an electronic device, and a computer-readable storage medium. The method includes: generating, in response to detecting that loading of all page resources of the webpage has completed, a query request for each image in the webpage, and caching the query request in a request queue; sequentially reading, from the request queue, and transmitting at least one query request, a number of the at least one query request being smaller than or equal to a set number, and obtaining a query result for each of the at least one transmitted query request; and (S130) determining, based on the query result, whether an image corresponding to the query result is successfully loaded.
Claims20
A method for monitoring an image in a webpage, comprising:
- generating, in response to detecting that loading of all page resources of the webpage has completed, image loading success query requests each for querying a local browser cache to determine whether a respective one of images in the webpage is successfully loaded, and caching the image loading success query requests in an image loading success query request queue, wherein the image loading success query requests each carries file position indication information of the image corresponding to the image loading success query request, and the file position indication information is used to indicate a storage position of the image in the local browser cache;
- sequentially reading, from the image loading success query request queue, and transmitting a first number of the image loading success query requests to the first number of data request threads of a browser for simultaneous processing, the first number being smaller than or equal to a set number, and the set number being smaller than a total number of data request threads that are allowed to be synchronously started by the browser loading the webpage;
- obtaining, based on a cache content in the local browser cache, an image loading success query result for each of the transmitted first number of image loading success query requests, wherein said obtaining, based on the cache content in the local browser cache, the image loading success query result for each of the transmitted first number of image loading success query requests comprises:
- querying, in the local browser cache, the image corresponding to the image loading success query request, to determine whether the image is found in the local browser cache as the image loading success query result;
- and
- determining, based on the image loading success query result, whether an image corresponding to the image loading success query result is successfully loaded, wherein said determining, based on the image loading success query result, whether the image corresponding to the image loading success query result is successfully loaded comprises:
- determining that the image is successfully loaded, when it is determined that the image is found in the local browser cache;
- and determining that the image is unsuccessfully loaded, when it is determined that the image is not found in the local browser cache.
An electronic device, comprising:
- a memory having a computer program stored thereon;
- and
- a processor configured to call the computer program to implement a method for monitoring an image in a webpage,
- wherein the method comprises:
- generating, in response to detecting that loading of all page resources of the webpage has completed, image loading success query requests each for querying a local browser cache to determine whether a respective one of images in the webpage is successfully loaded, and caching the image loading success query requests in an image loading success query request queue, wherein the image loading success query requests each carries file position indication information of the image corresponding to the image loading success query request, and the file position indication information is used to indicate a storage position of the image in the local browser cache;
- sequentially reading, from the image loading success query request queue, and transmitting a first number of the image loading success query requests to the first number of data request threads of a browser for simultaneous processing, the first number being smaller than or equal to a set number, and the set number being smaller than a total number of data request threads that are allowed to be synchronously started by the browser loading the webpage;
- obtaining, based on a cache content in the local browser cache, an image loading success query result for each of the transmitted first number of image loading success query requests, wherein said obtaining, based on the cache content in the local browser cache, the image loading success query result for each of the transmitted first number of image loading success query requests comprises:
- querying, in the local browser cache, the image corresponding to the image loading success query request, to determine whether the image is found in the local browser cache as the image loading success query result;
- and
- determining, based on the image loading success query result, whether an image corresponding to the image loading success query result is successfully loaded, wherein said determining, based on the image loading success query result, whether the image corresponding to the image loading success query result is successfully loaded comprises:
- determining that the image is successfully loaded, when it is determined that the image is found in the local browser cache;
- and determining that the image is unsuccessfully loaded, when it is determined that the image is not found in the local browser cache.
Dependencies are inferred from the claim text.