[go: up one dir, main page]

HK1241593A - Method and device for downloading picture by client - Google Patents

Method and device for downloading picture by client Download PDF

Info

Publication number
HK1241593A
HK1241593A HK18100882.1A HK18100882A HK1241593A HK 1241593 A HK1241593 A HK 1241593A HK 18100882 A HK18100882 A HK 18100882A HK 1241593 A HK1241593 A HK 1241593A
Authority
HK
Hong Kong
Prior art keywords
picture
native code
server
browser
data
Prior art date
Application number
HK18100882.1A
Other languages
Chinese (zh)
Other versions
HK1241593B (en
HK1241593A1 (en
Filing date
Publication date
Application filed filed Critical
Publication of HK1241593A publication Critical patent/HK1241593A/en
Publication of HK1241593A1 publication Critical patent/HK1241593A1/en
Publication of HK1241593B publication Critical patent/HK1241593B/en

Links

Description

Method and device for downloading picture by client
Technical Field
The invention relates to the technical field of internet, in particular to a method and a device for downloading pictures by a client.
Background
With the development of internet technology, various application software for facilitating work and life of people gradually appears, such as shopping software, video software, and financial software. Existing clients (i.e., application software) are mainly native clients, web clients, and hybrid clients in which native code is combined with the web. When the hybrid client accesses the webpage, the browser embedded in the client downloads and displays webpage data from the server side. Specifically, after a browser embedded in a client acquires a webpage source code from a server side, when a picture in a webpage needs to be displayed, a website of the picture is acquired from the webpage source code, then a picture downloading request carrying the website is sent to the server, and after the picture is downloaded, the picture is displayed.
However, currently, a browser embedded in a client generally has only two threads, one of which is a UI (user interface) main thread, and the other is an asynchronous task thread. Therefore, when the number of the pictures to be downloaded by the client is large, queuing is needed, so that the picture downloading efficiency is greatly reduced, and the webpage picture display efficiency is reduced.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for downloading a picture by a client, which can solve the problem of low picture downloading efficiency of the client in the prior art.
In one aspect, the present invention provides a method for downloading a picture by a client, where the method includes:
when a browser embedded in a client sends a picture downloading request to a server, a native code of an operating system to which the client belongs is used for intercepting the picture downloading request;
the native code starts at least one new thread to send the picture downloading request to the server;
the native code receives picture data returned by the server;
and the native code sends the picture data to the browser for display.
In another aspect, the present invention provides an apparatus for downloading pictures by a client, where the apparatus includes:
the acquisition unit is used for acquiring the picture downloading request by using a native code of an operating system to which the client belongs when a browser embedded in the client sends the picture downloading request to a server;
the sending unit is used for starting at least one new thread through the native code and sending the picture downloading request intercepted by the intercepting unit to the server;
the receiving unit is used for receiving the picture data returned by the server through the native code;
the sending unit is further configured to send the picture data to the browser for display through the native code.
By means of the technical scheme, when a browser embedded in a client sends a picture downloading request to a server, the method and the device for downloading the picture by the client can intercept the picture downloading request by using a native code of an operating system to which the client capable of starting more threads simultaneously belongs, then start at least one new thread to send the picture downloading request to the server according to a preset downloading mechanism through the native code, (for example, when the intercepted picture downloading request is more, a plurality of new threads can be started to send the picture downloading request to the server concurrently), and finally after the native code receives picture data returned by the server, the picture data can be sent to the embedded browser by the native code to be displayed. Therefore, compared with the prior art that the picture is directly downloaded by the embedded browser with less openable threads, the picture downloading method and the terminal have the advantages that the picture downloading request sent by the browser is intercepted and converted into the native code with more openable threads to download the picture, so that the picture downloading efficiency is improved, and the picture displaying efficiency of the client to the user is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating a method for downloading a picture by a client according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating another method for downloading pictures by a client according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating another method for downloading pictures by a client according to an embodiment of the present invention;
fig. 4 is a block diagram illustrating a device for downloading pictures by a client according to an embodiment of the present invention;
fig. 5 is a block diagram illustrating another apparatus for downloading pictures by a client according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
An embodiment of the present invention provides a method for downloading a picture by a client, where the method is applied to a client side, and as shown in fig. 1, the method mainly includes:
101. when a browser embedded in a client sends a picture downloading request to a server, a native code of an operating system to which the client belongs is used for intercepting the picture downloading request.
Where different operating systems may use different native code. For example, when the operating system is an iOS system, the native code is obj C (Objective-C, an object oriented programming language that extends C); when the operating system is an android system, the native code is Java.
When a user accesses a webpage based on a client, a browser embedded in the client or a native code of an operating system to which the client belongs can acquire HTML (HyperText markup language) data of the webpage to be accessed from the local part of the client or a server side, and then the HTML data is analyzed and rendered by the browser. When the web page to be accessed contains pictures, because only the website of the pictures is recorded in the HTML data, but not the substantial content of the pictures, when the browser determines that the website of the pictures is contained in the HTML data, corresponding picture downloading requests are respectively generated according to the website of each picture recorded in the HTML data, and then at most two threads are started to sequentially send different picture downloading requests to the server. At this time, because the number of threads that the browser can open is small, so that the picture downloading efficiency is low, when the browser sends the picture downloading requests to the server, the native codes of the operating system to which the client belongs are used for intercepting the picture downloading requests, so that the native codes reopen more threads to concurrently send a plurality of picture downloading requests to the server, and the picture downloading efficiency is improved.
It should be noted that, the specific scenario of "the browser embedded in the client sends the picture downloading request to the server" in this step is not limited. For example, the browser may send a picture downloading request to the server in a scene based on-demand downloading, or may send a picture downloading request to the server in a scene based on non-on-demand downloading. Wherein, downloading pictures as required means: before rendering the webpage data, not downloading all pictures in the webpage to the local first and then displaying according to the display requirements, but directly downloading the pictures according to the picture display requirements, namely sending a picture downloading request to a server when a picture tag enters a screen. Therefore, the method for downloading pictures on demand can save the picture downloading flow because not every picture in the webpage has the chance to enter the screen (for example, after the user opens the webpage based on the client, the user may jump to another page by clicking a link displayed in the screen without scrolling the page downwards, or directly closes the current page). In addition, the detailed implementation of the present invention in the on-demand download scenario can be seen in detail in the scenario embodiment of fig. 3.
102. And the native code starts at least one new thread to send the picture downloading request to the server.
After the native code intercepts and captures a picture downloading request sent by the browser to the server, data interaction between the browser and the server can be interrupted, and then picture downloading operation is realized by starting the data interaction between the native code and the server. Specifically, because the native code of the operating system to which the client belongs is a multi-core multi-thread mechanism, after the native code intercepts and captures the picture downloading request sent by the browser to the server, at least one new thread can be started to send the picture downloading request to the server again according to the number of the intercepted picture downloading requests. For example, the number of the picture downloading requests and the number of the new threads may be in a positive correlation, that is, the larger the number of the picture downloading requests is, the larger the number of the new threads to be turned on is.
103. And the native code receives the picture data returned by the server.
After the native code concurrently sends a plurality of picture download requests to the server based on at least one new thread, the at least one new thread may receive picture data that the server finds according to a Uniform Resource Locator (URL) in the picture download requests.
The image data received by the native code from the server side may be original image data that can be directly displayed, or may be image data that is convenient to transmit but cannot be directly displayed after the original image data is compressed, packaged, and the like. For example, the original picture data is data in a bitmap format, and in order to increase the data transmission speed, the server converts the picture data to be transmitted from the bitmap format into data in a jpeg format, and then transmits the picture data in the jpeg format to the original code.
104. And the native code sends the picture data to the browser for display.
In step 103, the image data received by the native code from the server may or may not be directly displayed, so that the client needs to convert the received image data into image data capable of being directly displayed and then display the image data by the browser.
The specific implementation manners of displaying pictures by a browser can be mainly classified into the following two types: (1) the native code directly sends the received picture data to the browser, so that when the picture data cannot be directly displayed, the browser directly converts the picture data into the picture data capable of being directly displayed, and then the picture data capable of being directly displayed is displayed; (2) when receiving the picture data returned by the server, the native code can firstly judge whether the picture data returned by the server can be directly displayed, if the picture data can be directly displayed, the picture data returned by the server is directly sent to the browser to be displayed, and if the picture data cannot be directly displayed, the native code firstly converts the picture data returned by the server into the picture data which can be directly displayed, and then sends the picture data which can be directly displayed to the browser to be displayed.
With respect to the second method, since the native code may receive all the picture data continuously rather than all the picture data at one time when there are many intercepted picture download requests, at least one new thread started by the native code may still perform the picture download operation. Therefore, in order to improve the efficiency of the format conversion of the picture data, the native code may additionally start other threads independent of the at least one new thread to convert the picture data returned by the server into the picture data capable of being directly displayed.
The method for downloading the picture by the client, provided by the embodiment of the invention, can be used for intercepting the picture downloading request by using the native code of the operating system to which the client capable of simultaneously starting more threads belongs when a browser embedded in the client sends the picture downloading request to the server, then starting at least one new thread to send the picture downloading request to the server according to a preset downloading mechanism through the native code (for example, when the intercepted picture downloading request is more, a plurality of new threads can be started to send the picture downloading request to the server concurrently), and finally after the native code receives the picture data returned by the server, the picture data can be sent to the embedded browser by the native code to be displayed. Therefore, compared with the prior art that the picture is directly downloaded by the embedded browser with less openable threads, the picture downloading method and the terminal have the advantages that the picture downloading request sent by the browser is intercepted and converted into the native code with more openable threads to download the picture, so that the picture downloading efficiency is improved, and the picture displaying efficiency of the client to the user is improved.
Further, according to the method shown in fig. 1, another embodiment of the present invention further provides a method for downloading a picture by a client, as shown in fig. 2, the method mainly includes:
201. when a browser embedded in a client sends a picture downloading request to a server, a native code of an operating system to which the client belongs is used for intercepting the picture downloading request.
The specific implementation manner of this step is the same as the specific implementation manner of step 101 in fig. 1, and is not described herein again.
202. The native code judges whether picture data corresponding to the picture downloading request is cached locally; if the picture data corresponding to the picture downloading request is cached locally in the native code, executing step 203; if the native code does not locally cache the picture data corresponding to the picture downloading request, step 204 and step 206 are executed.
When a user re-accesses the same webpage each time, the client needs to re-download the picture in the webpage from the server side, however, in practical application, the user often frequently accesses the same webpage (for example, the user browses the webpage 1 for 1 time in a half day), so in order to improve the efficiency of the user to access the webpage picture, after the native code first obtains some picture data from the server side, the picture data and the website of the picture can be cached to the local, and then when the user re-accesses the picture, the picture downloading operation from the server side is not needed, and the picture data can be directly obtained from the local.
Therefore, after the native code receives the picture downloading request sent by the browser to the server, whether picture data corresponding to the picture downloading request is cached locally or not can be judged; if the picture data corresponding to the picture downloading request is locally cached, the locally cached picture data can be sent to a browser for displaying; and if the picture data corresponding to the picture downloading request is not cached locally, sending the picture downloading request to the server, and downloading the picture data from the server side. The specific implementation manner of the native code determining whether the picture data corresponding to the picture downloading request is cached locally may be: the native code firstly acquires the website of the picture from the picture downloading request, and then searches the website of the picture from the local; if the website of the picture is found, determining picture data corresponding to the locally cached website of the picture as picture data corresponding to the picture downloading request; and if the website of the picture is not found, determining that no picture data corresponding to the picture downloading request exists locally.
203. And the native code sends the locally cached picture data to the browser for display.
When caching the picture data, the native code may directly cache the picture data that can be directly displayed, or may cache the picture data that cannot be directly displayed after processing such as compression and encapsulation, so the specific implementation manner in which the native code sends the locally cached picture data to the browser for display may also be divided into two types: (1) the native code directly sends the locally cached picture data to the browser, and after the browser receives the picture data, if the picture data cannot be directly displayed, the picture data is firstly converted into the picture data capable of being directly displayed and then displayed; (2) if the locally cached picture data can be directly displayed, the native code directly sends the picture data to a browser for display; if the locally cached picture data can not be directly displayed, the native code starts a thread to convert the cached picture data into the picture data capable of being directly displayed, and then sends the picture data capable of being directly displayed to the server for displaying.
204. And the native code starts at least one new thread to send the picture downloading request to the server.
The specific implementation manner of this step is the same as the specific implementation manner of step 102 in fig. 1, and is not described herein again.
205. And the native code receives the picture data returned by the server.
In order to improve the picture display efficiency when the picture data is subsequently accessed again, the native code may cache the picture data after receiving the picture data returned by the server, so as to be directly obtained from the local in the subsequent step.
Specifically, the native code may directly cache the image data returned by the server and the corresponding website to the local based on a preset cache mechanism; or after the image data capable of being directly displayed is acquired based on the image data returned by the server, the image data capable of being directly displayed and the website are cached locally based on the preset caching mechanism.
The preset caching mechanism may include: deleting image data which are not frequently accessed and corresponding websites regularly; when the memory of the client is insufficient, deleting the picture data with longer caching time and the corresponding website; and only caching the picture data frequently accessed by the user, the corresponding website and the like.
206. And the native code sends the picture data to the browser for display.
The specific implementation manner of this step is the same as the specific implementation manner of step 104 in fig. 1, and is not described herein again.
The method for downloading the picture by the client provided by the embodiment of the invention can not only intercept the picture downloading request through the native code, switch the picture downloading by the embedded browser with less openable threads into the picture downloading by the native code with more openable threads, thereby improving the picture downloading efficiency and further improving the picture displaying efficiency of the client to the user, but also cache the downloaded picture data to the local based on a cache mechanism after the native code downloads the picture from the server side, so that when the picture is required to be displayed again by the client subsequently, the corresponding picture data can be directly obtained from the local without spending time and wasting flow, thereby further improving the picture displaying efficiency of the client to the user.
In the above embodiments, in order to save the picture downloading traffic, the picture may be downloaded by using an on-demand downloading method. As shown in fig. 3, the following describes a scenario of downloading pictures on demand as an example:
301. after the webpage data are obtained, the native code of the operating system of the client removes the website of the picture in the webpage data to a preset storage space.
Img tags in web page data (e.g., HTML data) are used to embed a picture in a web page. Technically, the img tag does not insert the essence of the picture into the webpage, but inserts the website of the picture. Specifically, the img tag contains two necessary attributes, namely, an src attribute and an alt attribute. The src attribute is used for recording the website of the picture, and the alt attribute is used for displaying only pure characters as a remedy when the picture cannot be rendered. Therefore, if the src attribute of the img tag in the network data is removed to the preset storage space by the native code, the browser cannot render the corresponding picture, so that the browser is prevented from downloading all pictures in the webpage to the local.
When the src attribute is removed to the preset storage space, the native code may remove only the URL in the "src ═ URL", may replace the URL with another character, or may remove the entire "src ═ URL". In addition, the preset storage space can be a storage space where the custom attribute data-src is located, that is, the URL in the src attribute can be removed to the custom attribute data-src.
302. And the native code sends the webpage data with the website removed to the browser for display.
After the native code sends the web page data with the website removed to the browser, the browser renders other data except for the picture, and in the process of rendering other data, if an unloaded picture is found to exist in the screen, the picture can be loaded and displayed by executing step 303 and step 310.
303. And when determining that the unloaded picture exists in the screen, adding the website of the unloaded picture stored in the preset storage space to the corresponding position of the webpage data by the native code.
The specific implementation manner of the native code for judging whether the screen contains the unloaded picture may be as follows: judging whether the img label enters the screen or not by a JavaScript method; if the picture corresponding to the img label is downloaded, determining that the picture which is not loaded exists in the screen, and if the picture which is corresponding to the img label and enters the screen is downloaded, determining that the picture which is not loaded does not exist in the screen; and if no img label enters the screen, determining that no unloaded picture exists in the screen. The JavaScript method is a program written based on a native language and executed in an embedded browser.
When it is determined that an unloaded picture exists in the screen, the native code may determine that the browser has a requirement for rendering the picture, and therefore, an src attribute of an img tag corresponding to the unloaded picture stored in a preset storage space may be added to the img tag, so as to trigger the browser to send a picture download request to the server through a URL in the src attribute.
304. And the browser sends a picture downloading request carrying the website to the server.
305. And intercepting the picture downloading request by using a native code of an operating system to which the client belongs.
306. The native code judges whether picture data corresponding to the picture downloading request is cached locally; if the picture data corresponding to the picture downloading request is cached locally in the native code, executing step 307; if the native code does not locally cache the picture data corresponding to the picture downloading request, step 308 and step 310 are executed.
307. And the native code sends the locally cached picture data to the browser for display.
308. And the native code starts at least one new thread to send the picture downloading request to the server.
309. And the native code receives the picture data returned by the server.
310. And the native code sends the picture data to the browser for display.
Further, according to the foregoing method embodiment, another embodiment of the present invention further provides a device for downloading a picture by a client, as shown in fig. 4, the device mainly includes: an interception unit 41, a sending unit 42, and a receiving unit 43. Wherein the content of the first and second substances,
an intercepting unit 41, configured to intercept, when a browser embedded in a client sends a picture downloading request to a server, the picture downloading request using a native code of an operating system to which the client belongs;
a sending unit 42, configured to start at least one new thread through the native code and send the picture download request intercepted by the intercepting unit 41 to the server;
a receiving unit 43, configured to receive, through the native code, picture data returned by the server;
the sending unit 42 is further configured to send the picture data to the browser for display through the native code.
Optionally, as shown in fig. 5, the apparatus further includes:
a determining unit 44, configured to determine whether picture data corresponding to the picture downloading request is cached locally through the native code before the sending unit 42 starts at least one new thread through the native code to send the picture downloading request to the server;
the sending unit 42 is configured to start the at least one new thread through the native code to send the picture downloading request to the server when the determination result of the determining unit 44 is that the picture data corresponding to the picture downloading request is not cached locally in the native code.
Optionally, the sending unit 42 is further configured to send, when the determination result of the determining unit 44 is that the picture data corresponding to the picture downloading request is stored in the local cache of the native code, the picture data cached locally to the browser through the native code for display.
Optionally, as shown in fig. 5, the apparatus further includes:
the caching unit 45 is configured to cache the picture data returned by the server and the corresponding website to the local based on a preset caching mechanism through the native code; or after the image data capable of being directly displayed is acquired based on the image data returned by the server through the native code, the image data capable of being directly displayed and the website are cached to the local based on the preset caching mechanism.
Optionally, as shown in fig. 5, the apparatus further includes:
a conversion unit 46, configured to, before the sending unit 42 sends the picture data to the browser through the native code for display, if the picture data cannot be directly displayed, start, through the native code, another thread independent of the at least one new thread to convert the picture data returned by the server into picture data capable of being directly displayed;
the sending unit 42 is further configured to send the directly displayable picture data to the browser for display through the native code.
Optionally, the sending unit 42 is further configured to send a picture downloading request to the server through a browser embedded in the client;
as shown in fig. 5, the apparatus further includes:
a removing unit 47, configured to remove, before the sending unit 42 sends a picture downloading request to a server through a browser embedded in a client, a website of a picture in web page data to a preset storage space through the native code after the web page data is acquired;
the sending unit 42 is further configured to send the web page data with the website removed to the browser for display through the native code;
an adding unit 48, configured to add, by using the native code, a website address of the unloaded picture stored in the preset storage space to a corresponding position of the web page data when it is determined that the unloaded picture exists in the screen;
the sending unit 42 is configured to send a picture downloading request carrying the website to the server through the browser.
The device for downloading the picture at the client side provided by the embodiment of the invention can intercept the picture downloading request by using the native code of the operating system to which the client side capable of simultaneously starting more threads belongs when the browser embedded at the client side sends the picture downloading request to the server, then start at least one new thread to send the picture downloading request to the server according to the preset downloading mechanism through the native code (for example, when the intercepted picture downloading request is more, a plurality of new threads can be started to send the picture downloading request to the server concurrently), and finally after the native code receives the picture data returned by the server, the picture data can be sent to the embedded browser by the native code to be displayed. Therefore, compared with the prior art that the picture is directly downloaded by the embedded browser with less openable threads, the picture downloading method and the terminal have the advantages that the picture downloading request sent by the browser is intercepted and converted into the native code with more openable threads to download the picture, so that the picture downloading efficiency is improved, and the picture displaying efficiency of the client to the user is improved. In addition, after the native code downloads the picture from the server side, the downloaded picture data is cached to the local based on the caching mechanism, so that when the picture is required to be displayed again by the client side subsequently, the corresponding picture data can be directly obtained from the local, time is not required to be spent, the flow is not wasted, and the picture data is downloaded from the server side, so that the picture displaying efficiency of the client side to a user is further improved.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the method and apparatus described above are referred to one another. In addition, "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent merits of the embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed 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 furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the method and apparatus for client-side picture downloading according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (12)

1. A method for downloading pictures by a client, the method comprising:
when a browser embedded in a client sends a picture downloading request to a server, a native code of an operating system to which the client belongs is used for intercepting the picture downloading request;
the native code starts at least one new thread to send the picture downloading request to the server;
the native code receives picture data returned by the server;
and the native code sends the picture data to the browser for display.
2. The method of claim 1, wherein before the native code starts at least one new thread to send the picture download request to the server, the method further comprises:
the native code judges whether picture data corresponding to the picture downloading request is cached locally;
the native code starting at least one new thread to send the picture download request to the server comprises:
and if the native code does not locally cache the picture data corresponding to the picture downloading request, the native code starts the at least one new thread to send the picture downloading request to the server.
3. The method of claim 2, wherein if the native code locally caches picture data corresponding to the picture download request, the method further comprises:
and the native code sends the locally cached picture data to the browser for display.
4. The method of claim 2, wherein after the native code receives the picture data returned by the server, the method further comprises:
the native code caches the image data returned by the server and the corresponding website to the local based on a preset caching mechanism;
or after the native code acquires the directly displayable picture data based on the picture data returned by the server, caching the directly displayable picture data and the website to the local based on the preset caching mechanism.
5. The method of claim 1, wherein prior to the native code sending the picture data to the browser for display, the method further comprises:
if the picture data can not be directly displayed, the native code starts other threads independent of the at least one new thread to convert the picture data returned by the server into the picture data capable of being directly displayed;
the sending, by the native code, the picture data to the browser for display includes:
and the native code sends the directly displayable picture data to the browser for displaying.
6. The method according to any one of claims 1 to 5, wherein before the browser embedded in the client sends a picture download request to the server, the method further comprises:
after acquiring the webpage data, the native code removes the website of the picture in the webpage data to a preset storage space;
the native code sends the webpage data with the website removed to the browser for display;
when determining that the unloaded picture exists in the screen, adding the website of the unloaded picture stored in the preset storage space to the corresponding position of the webpage data by the native code;
the step of sending the picture downloading request to the server by the browser embedded in the client comprises the following steps:
and the browser sends a picture downloading request carrying the website to the server.
7. An apparatus for downloading pictures by a client, the apparatus comprising:
the acquisition unit is used for acquiring the picture downloading request by using a native code of an operating system to which the client belongs when a browser embedded in the client sends the picture downloading request to a server;
the sending unit is used for starting at least one new thread through the native code and sending the picture downloading request intercepted by the intercepting unit to the server;
the receiving unit is used for receiving the picture data returned by the server through the native code;
the sending unit is further configured to send the picture data to the browser for display through the native code.
8. The apparatus of claim 7, further comprising:
the judging unit is used for judging whether picture data corresponding to the picture downloading request is cached locally or not through the native code before the sending unit starts at least one new thread through the native code to send the picture downloading request to the server;
the sending unit is used for starting the at least one new thread through the native code to send the picture downloading request to the server when the judging result of the judging unit is that the picture data corresponding to the picture downloading request is not cached locally in the native code.
9. The apparatus according to claim 8, wherein the sending unit is further configured to send the locally cached picture data to the browser for display through the native code when the determination result of the determining unit is that the picture data corresponding to the picture downloading request is locally cached in the native code.
10. The apparatus of claim 8, further comprising:
the caching unit is used for caching the image data returned by the server and the corresponding website to the local part based on a preset caching mechanism through the native code; or after the image data capable of being directly displayed is acquired based on the image data returned by the server through the native code, the image data capable of being directly displayed and the website are cached to the local based on the preset caching mechanism.
11. The apparatus of claim 7, further comprising:
the conversion unit is used for starting other threads independent of the at least one new thread through the native code to convert the picture data returned by the server into the picture data capable of being directly displayed if the picture data cannot be directly displayed before the sending unit sends the picture data to the browser for display through the native code;
the sending unit is further configured to send the directly displayable picture data to the browser for display through the native code.
12. The apparatus according to any one of claims 7 to 11, wherein the sending unit is further configured to send a picture download request to a server through a browser embedded in a client;
the device further comprises:
the removing unit is used for removing the website of the picture in the webpage data to a preset storage space through the native code after the webpage data is acquired before the sending unit sends a picture downloading request to a server through a browser embedded in a client;
the sending unit is also used for sending the webpage data with the website removed to the browser for display through the native code;
the adding unit is used for adding the website of the unloaded picture stored in the preset storage space to the corresponding position of the webpage data through the native code when the unloaded picture is determined to exist in the screen;
the sending unit is used for sending a picture downloading request carrying the website to the server through the browser.
HK18100882.1A 2018-01-22 Method and device for downloading picture by client HK1241593B (en)

Publications (3)

Publication Number Publication Date
HK1241593A true HK1241593A (en) 2018-06-08
HK1241593A1 HK1241593A1 (en) 2018-06-08
HK1241593B HK1241593B (en) 2021-04-01

Family

ID=

Similar Documents

Publication Publication Date Title
CN107040584B (en) Method and device for downloading picture by client
US11647096B2 (en) Method and apparatus for automatically optimizing the loading of images in a cloud-based proxy service
US11032388B2 (en) Methods for prerendering and methods for managing and configuring prerendering operations
US8745212B2 (en) Access to network content
US9563929B1 (en) Caching of content page layers
WO2020199751A1 (en) Method and apparatus for loading page picture, and electronic device
CN110442815B (en) Page generation method, system, device and computer readable storage medium
US10754900B2 (en) Access to network content
CN104935655A (en) Data display method and device
CN105095280A (en) Caching method and apparatus for browser
CN112115396A (en) Webpage rendering method, device, equipment and storage medium
CN112637361B (en) Page proxy method, device, electronic equipment and storage medium
US10158691B2 (en) Method and apparatus for providing network resources at intermediary server
CN104462571A (en) Webpage loading method and device and browser client-side
CN110795650A (en) Webpage opening method and device and computer readable storage medium
CN111191158A (en) Web page resource caching method, apparatus, computer equipment and storage medium
EP3863252B1 (en) Advertisement anti-shielding method and device
CN113742551A (en) A dynamic data capture method based on scrapy and puppeteer
CN108376090A (en) Method, device, terminal and storage medium for operating web page pictures
HK1241593A (en) Method and device for downloading picture by client
HK1241593A1 (en) Method and device for downloading picture by client
CN111475748A (en) Picture display method and device
CN115859333A (en) File transmission encryption method, device, equipment and readable storage medium
CN106055647A (en) Webpage display processing method and device
CN121071249A (en) A method, apparatus, device, medium, and program product for processing page data.