CN113886228B - Compatibility detection method and device, storage medium and electronic equipment - Google Patents

Compatibility detection method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN113886228B
CN113886228B CN202111128045.3A CN202111128045A CN113886228B CN 113886228 B CN113886228 B CN 113886228B CN 202111128045 A CN202111128045 A CN 202111128045A CN 113886228 B CN113886228 B CN 113886228B
Authority
CN
China
Prior art keywords
image compression
compression format
image
pixel block
detection pixel
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202111128045.3A
Other languages
Chinese (zh)
Other versions
CN113886228A (en
Inventor
刘希呈
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology Co Ltd
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 Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN202111128045.3A priority Critical patent/CN113886228B/en
Publication of CN113886228A publication Critical patent/CN113886228A/en
Application granted granted Critical
Publication of CN113886228B publication Critical patent/CN113886228B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Information Transfer Between Computers (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The specification discloses a compatibility detection method, a device, a storage medium and electronic equipment. And then, respectively generating detection pixel blocks corresponding to each image compression format, and respectively loading the detection pixel blocks corresponding to each image compression format into the main frame of the page for rendering. And finally, according to the rendering result of the detection pixel block corresponding to each image compression format in the terminal, determining the compatibility of the image compression format and the terminal, and loading the image in the image compression format compatible with the terminal. The method comprises the steps of loading detection pixel blocks of all image compression formats in a main body frame of a page, rendering, determining the compatibility of the terminal and all image compression formats according to a rendering result, and further loading images of the image compression formats compatible with the terminal. The page loading failure caused by incompatibility in the page loading process is avoided, the user experience is improved, and meanwhile, the network bandwidth is saved.

Description

Compatibility detection method and device, storage medium and electronic equipment
Technical Field
The present application relates to the field of internet technologies, and in particular, to a compatibility detection method, apparatus, storage medium, and electronic device.
Background
At present, when a user accesses a webpage, a terminal can load a main body frame of the webpage first and then asynchronously load each page element in the webpage so as to reduce the waiting time of the user.
When the page element is an image, in order to increase the page loading speed, an image in an image compression format after compression, for example, an image in a webp format after compression, is usually loaded. However, each image compression format has a terminal type incompatible therewith, and when the terminal is incompatible with the loaded image compression format, page loading fails, and user experience is poor.
Therefore, in the prior art, when an image is asynchronously loaded, a terminal can send an image loading request carrying a terminal identifier to a corresponding server. Then, the server can determine and issue the image data in the image compression format compatible with the terminal according to the terminal identifier carried in the request header of the loading request and the compatibility relationship between each terminal type and the image compression format stored in advance.
However, since the variety of image compression formats is large and the types of terminals on the market are diversified, the compatibility relationship between each image compression format and each terminal type is configured, which results in a large amount of work. Therefore, under the condition that a compatibility relationship is not configured, how to avoid page loading failure caused by incompatibility becomes a problem which needs to be solved urgently.
Disclosure of Invention
Embodiments of the present specification provide a compatibility detection method, an apparatus, a storage medium, and an electronic device, which are used to partially solve problems in the prior art.
The embodiment of the specification adopts the following technical scheme:
the compatibility detection method provided by the present specification includes:
loading a main body frame of the page;
generating a detection pixel block corresponding to each image compression format to be detected;
loading the detection pixel block corresponding to the image compression format into the main body frame and rendering;
judging whether the detection pixel block corresponding to the image compression format is rendered successfully or not;
if yes, determining that the image compression format is compatible with the terminal;
if not, determining that the image compression format is incompatible with the terminal.
Optionally, the loading, into the main body frame, the detection pixel block corresponding to the image compression format, and rendering the detection pixel block specifically includes:
loading the detection pixel block corresponding to the image compression format into the main body frame;
and rendering the loaded main body frame and the detection pixel block in an off-screen canvas.
Optionally, the determining whether the detection pixel block corresponding to the image compression format is rendered successfully includes:
determining a detection pixel block corresponding to the image compression format and an element node in a document object model corresponding to the page;
and judging whether the detection pixel block corresponding to the image compression format is rendered successfully or not according to the attribute information of the element node.
Optionally, the attribute information of the element node at least includes a width and a height of the element node.
Optionally, when it is determined that the image compression format is compatible with the terminal, the method further comprises:
and aiming at the image to be rendered in the page, acquiring the image to be rendered in the image compression format, and rendering the page according to the image to be rendered in the image compression format.
Optionally, when it is determined that the image compression format is incompatible with the terminal, the method further comprises:
and aiming at the image to be rendered in the page, acquiring the image to be rendered in a default format, and rendering the page according to the image to be rendered in the default format.
Optionally, the detection pixel block is a transparent pixel block, and/or the detection pixel block is a unit pixel size.
This specification provides a compatibility detection device, including:
the loading module is configured to load a main body frame of the page;
the generating module is configured to generate a detection pixel block corresponding to each image compression format to be detected;
the rendering module is configured to load the detection pixel block corresponding to the image compression format into the main body frame and render the detection pixel block;
and the judging module is configured to judge whether the rendering of the detection pixel block corresponding to the image compression format is successful, determine that the image compression format is compatible with the terminal if the rendering is successful, and determine that the image compression format is incompatible with the terminal if the rendering is not successful.
The present specification provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the compatibility detection method described above.
The present specification provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the compatibility detection method when executing the program.
The embodiment of the specification adopts at least one technical scheme which can achieve the following beneficial effects:
in this specification, in the page loading process, the body frame of the page may be loaded first. And then, respectively generating detection pixel blocks corresponding to each image compression format, and respectively loading the detection pixel blocks corresponding to each image compression format into the main frame of the page for rendering. And finally, according to the rendering result of the detection pixel block corresponding to each image compression format in the terminal, determining the compatibility of the image compression format and the terminal, and loading the image of the image compression format compatible with the terminal. The method comprises the steps of loading detection pixel blocks of all image compression formats in a main frame of a page, rendering, determining the compatibility of the terminal and all image compression formats according to rendering results, and further loading images of the image compression formats compatible with the terminal. The page loading failure caused by incompatibility in the page loading process is avoided, the user experience is improved, and meanwhile, the network bandwidth is saved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart of a compatibility detection method provided in an embodiment of the present specification;
fig. 2 is a schematic diagram of interaction between devices for page loading according to an embodiment of the present specification;
fig. 3 is a schematic structural diagram of a compatibility detection apparatus provided in an embodiment of the present disclosure;
fig. 4 is a schematic view of an electronic device implementing a compatibility detection method according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more apparent, the technical solutions of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person skilled in the art without making any inventive step based on the embodiments in the description belong to the protection scope of the present application.
In order to increase the page loading speed, in the prior art, when page data is acquired, an image compression format with a small data volume after compression, such as a webp format, is generally acquired. However, since the image in the image compression format is not compatible with all terminal types and all browser versions, when the loaded image compression format is not compatible with the terminal, the page loading of the terminal is failed, and the user experience is affected.
At present, for different terminals, the mode of returning image data in different image compression formats needs to be configured in real time based on continuous updating of terminal types, and the engineering quantity is large.
Based on the above technical problems, the present specification provides a compatibility detection method, which may perform compatibility detection on each image compression format and a terminal first in a page loading process, and then load image data that is compatible with the terminal and has a small amount of compressed data. The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a compatibility detection method provided in an embodiment of the present specification, which may specifically include the following steps:
s100: and loading the main body frame of the page.
The compatibility detection method provided by the present specification can detect the compatibility of the terminal and each image compression format in the process of loading the page by the terminal, and therefore the main execution body of the compatibility detection method is the terminal device for loading the page.
Specifically, when loading a web page, the terminal may load a main body frame of the web page first. The main body frame may be pre-stored locally in the terminal, or may be obtained by the terminal from a server in real time. The specification does not limit this, and can set this as required.
Furthermore, the main body frame also comprises a compatibility detection container for performing compatibility detection. The compatibility detection container comprises a compatibility detection code written in advance, an operation environment and the like, can be deployed in a terminal, and tests the compatibility of the terminal and each image compression format. S102: and generating a detection pixel block corresponding to each image compression format to be detected.
In one or more embodiments of the present description, typically during page loading, the body frame of a page is loaded asynchronously with the page content. In order to ensure that the terminal is compatible with the loaded image, the terminal may be subjected to a compatibility test before the image is loaded.
Specifically, the terminal may generate a detection pixel block corresponding to each image compression format to be detected, so as to detect whether the image compression format is compatible with the terminal through subsequent steps. If the image compression format is the webp format, the detection pixel block is the pixel block of the webp format.
Further, the compression format of the image to be detected in this specification may be, for example, a webp format with the minimum data size after compression is selected. The image compression format to be detected can be various, such as JPEG format and webp format, and the compatibility of various image compression formats with the terminal can be respectively detected, so that the image in the image compression format compatible with the terminal can be loaded.
Further, when generating the detection pixel blocks corresponding to the respective image compression formats, the detection pixel blocks corresponding to the image compression formats may be generated by running the compatibility detection code in the compatibility detection container for each image compression format.
The image compression format is compatible with the terminal or not, and is irrelevant to the image size, so that the image data of the minimum unit corresponding to each image compression format can be generated in order to save the memory resource occupied during the compatibility test. The detection pixel block may then be a unit pixel size, such as 1 pixel wide and high. And, the detection pixel block can be a transparent pixel block, and can be coded by Base 64.
S104: and loading the detection pixel block corresponding to the image compression format into the main body frame, and rendering.
In one or more embodiments of the present disclosure, after generating the detection pixel block in the image compression format, an off-screen Canvas (offset Canvas) manner may be adopted to render the detection pixel block while the detection pixel block is off-screen, and perform compatibility determination according to a rendering result.
Specifically, the terminal may load the detection pixel block corresponding to the image compression format into the main body frame, and perform off-screen rendering on the loaded main body frame and the detection pixel block in an off-screen canvas.
In general, when rendering a page, a terminal may generate a Document Object Model (DOM) according to HyperText Markup Language (HTML) of the page. And generates a CSSOM tree based on a Cascading Style Sheets (CSS) file of the page. The CSSOM includes style information of each node, such as font, color, and the like. And then combining the DOM tree with the CSSOM tree to generate a render tree (render), and performing layout rendering according to the render tree.
Therefore, in this specification, when rendering the main body frame and the detection pixel block, the detection pixel block may be added to a corresponding element node in the DOM tree as one page element, and a rendering tree is generated through subsequent steps to perform layout rendering.
S106: and judging whether the detection pixel block corresponding to the image compression format is rendered successfully or not, if so, executing step S108, and if not, executing step S110.
In one or more embodiments of the present description, compatibility of the image compression format with a terminal may be detected according to a result of rendering, in the terminal, of a detected pixel block of the image compression format.
Specifically, the terminal may determine the detection pixel block corresponding to the image compression format, and load the detection pixel block to a corresponding element node in a DOM tree of the page. And then, judging whether the detection pixel block corresponding to the image compression format is rendered successfully or not according to the attribute information of the element node.
When the attribute information of the element node can be acquired, it indicates that the layout position of the element node in the page has been determined, and the element node can be directly displayed, so that the rendering of the detection pixel block can be considered to be successful. The attribute information of the element node includes at least a width and a height of the element node, and the like.
S108: the image compression format is determined to be compatible with the terminal.
If the detection pixel block of the image compression format can be successfully rendered in the terminal, the image compression format is compatible with the terminal, and the terminal can load the image compressed by the image compression format, so that the image data transmission quantity is reduced, and the network bandwidth is saved.
In an embodiment of the present specification, the main body frame of the page may include an image obtaining address of each image compression format of each image to be rendered in the page and an image obtaining address of a default format, that is, a Uniform Resource Locator (URL). The default Format is different from each image compression Format, and may be a lossless compression Portable Network graphics Format (PNG) or an uncompressed image Format, so as to ensure complete compatibility with various types of terminals.
Then, for each image to be rendered in the page, the terminal may determine a URL corresponding to the image compression format from the URLs of each image compression format of the image to be rendered, and send an image acquisition request to a corresponding image server according to the URL corresponding to the image compression format to acquire the image to be rendered in the image compression format. And performing page rendering according to the image to be rendered in the image compression format.
Further, when it is determined that the image compression format is compatible with the terminal, the terminal may also modify, through the compatibility detection container, the image acquisition address of the default format of each image to be rendered in the page to the image acquisition address of the image compression format, so as to acquire an image based on the modified image acquisition address.
In another embodiment of the present specification, the page may only contain a URL in a default format of the image in the body frame. When the image compression format is determined to be compatible with the terminal, the terminal can still send an image acquisition request to the corresponding image server according to the URL of the default format of the image to be rendered for each image to be rendered. Wherein, the image obtaining request also carries the identifier of the image compression format. And enabling the image server to return the image to be rendered in the image compression format according to the identifier of the image compression format in the image acquisition request.
S110: it is determined that the image compression format is incompatible with the terminal.
In one or more embodiments of the present specification, if the detected pixel block of the image compression format fails to be rendered in the terminal, it indicates that the image compression format is incompatible with the terminal, and loading the image of the image compression format in the terminal may result in a page rendering failure and a page display error.
Then, for the image to be rendered in the page, the terminal may send an image obtaining request to the corresponding image server according to the image obtaining address of the default format of the image to be rendered, so as to obtain the image to be rendered in the default format, and perform page rendering according to the obtained image to be rendered in the default format.
Based on the compatibility detection method shown in fig. 1, in the page loading process, the main body frame of the page may be loaded first. And then, respectively generating detection pixel blocks corresponding to each image compression format, and respectively loading the detection pixel blocks corresponding to each image compression format into the main frame of the page for rendering. And finally, according to the rendering result of the detection pixel block corresponding to each image compression format in the terminal, determining the compatibility of the image compression format and the terminal. The method comprises the steps of loading detection pixel blocks of all image compression formats in a main frame of a page, rendering, determining the compatibility of the terminal and all image compression formats according to rendering results, and further loading images of the image compression formats compatible with the terminal. The page loading failure caused by incompatibility in the page loading process is avoided, the user experience is improved, and meanwhile, the network bandwidth is saved.
In one or more embodiments of the present specification, when there are multiple image compression formats to be detected, the terminal may detect compatibility of each image compression format with the terminal, and select an image compression format with the minimum compressed data size from the image compression formats compatible with the terminal, and load an image in the image compression format with the minimum data size.
However, in order to reduce the waiting time of the user in the page loading process, the image compression format with the highest priority can be determined as the target compression format according to the preset priority order of each image compression format. And then, generating a detection pixel block in the target compression format, loading the detection pixel block in the target compression format in the main body frame of the page, and rendering the detection pixel block. When the detection pixel block of the target compression format is successfully rendered and the target compression format is compatible with the terminal, the image to be rendered in the target compression format can be directly loaded without performing compatibility detection on other image compression formats.
When the priority order of the image compression formats is set, priority ordering can be performed according to the size of the image data compressed by the image compression formats, and the smaller the amount of the image data compressed by the image compression formats is, the higher the priority is. For example, set to webp format > JPEG format > PNG format.
When the target compression format is incompatible with the terminal, the terminal can re-determine the next image compression format as the target compression format according to a preset priority order, and re-detect whether the target compression format is compatible with the terminal, and when each image compression format is incompatible with the terminal directly, the image to be rendered in the default format is obtained according to the image obtaining address of the image default format.
In one or more embodiments of the present specification, the server providing the page body frame and the server providing the image data may be the same server or different servers.
Taking a server providing a page body frame as a service server and a server providing image data as an image server as an example for explanation, as shown in fig. 2, fig. 2 is an interaction schematic diagram between a terminal and each server. When loading a page, the terminal may first send a page loading request to the service server, and receive a main body frame of the page returned by the service server. And then, the terminal can generate detection pixel blocks in each image compression format and respectively load the detection pixel blocks into the main body frame of the page for rendering. Then, according to the rendering result of the detection pixel block of each image compression format, the compatibility between each image compression format and the terminal is determined. Finally, the terminal can determine an image acquisition address of an image compression format compatible with the terminal, and sends an image acquisition request to an image server according to the image acquisition address so as to acquire an image to be rendered of the image compression format compatible with the terminal. And finally, rendering and displaying the page according to the acquired image to be rendered.
After a developer uploads each image configured in each page to an image server according to a page configuration file, the image server can automatically generate a plurality of image compression formats corresponding to each uploaded image, and different image acquisition addresses are respectively set for different image compression formats of the image. For example, the image in the page configuration file is in a PNG format, and after the image in the PNG format is uploaded to an image server, the JPEG format and the webp format of the image can be generated and stored.
Based on the compatibility detection method shown in fig. 1, an embodiment of the present specification further provides a schematic structural diagram of a compatibility detection apparatus, as shown in fig. 3.
Fig. 3 is a schematic structural diagram of a compatibility detection apparatus provided in an embodiment of the present disclosure, including:
a loading module 200 configured to load a body frame of a page;
the generating module 202 is configured to generate a detection pixel block corresponding to each image compression format to be detected;
a rendering module 204 configured to load the detection pixel block corresponding to the image compression format into the main body frame and perform rendering;
the determining module 206 is configured to determine whether the detected pixel block corresponding to the image compression format is rendered successfully, determine that the image compression format is compatible with the terminal if the detected pixel block is rendered successfully, and determine that the image compression format is incompatible with the terminal if the detected pixel block is not rendered successfully.
Optionally, the rendering module 204 is specifically configured to load the detection pixel block corresponding to the image compression format into the main body frame, and render the loaded main body frame and the detection pixel block in an off-screen canvas.
Optionally, the determining module 206 is specifically configured to determine a detection pixel block corresponding to the image compression format, and determine, according to the attribute information of the element node, whether the detection pixel block corresponding to the image compression format is rendered successfully at the element node in the document object model corresponding to the page.
Optionally, the attribute information of the element node at least includes a width-height value of the element node.
Optionally, the determining module 206 is further configured to, for the image to be rendered in the page, obtain the image to be rendered in the image compression format, and perform page rendering according to the image to be rendered in the image compression format.
Optionally, the determining module 206 is further configured to, for the image to be rendered in the page, obtain an image to be rendered in a default format, and render the page according to the image to be rendered in the default format.
Optionally, the detection pixel block is a transparent pixel block, and/or the detection pixel block is a unit pixel size.
Embodiments of the present specification further provide a computer-readable storage medium, where the storage medium stores a computer program, and the computer program is operable to execute the compatibility detection method provided in fig. 1.
According to a compatibility detection method shown in fig. 1, an embodiment of the present specification further provides a schematic structural diagram of the electronic device shown in fig. 4. As shown in fig. 4, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, but may also include hardware required for other services. The processor reads a corresponding computer program from the non-volatile memory into the memory and then runs the computer program to implement the compatibility detection method shown in fig. 1.
Of course, besides the software implementation, the present specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical blocks. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and create a dedicated integrated circuit chip. Furthermore, nowadays, instead of manually generating an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as ABEL (Advanced Boolean Expression Language), AHDL (alternate Hardware Description Language), traffic, CUPL (core universal Programming Language), HDCal, jhddl (Java Hardware Description Language), lava, lola, HDL, PALASM, rhyd (Hardware Description Language), and vhigh-Language (Hardware Description Language), which is currently used in most popular applications. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be conceived to be both a software module implementing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the system embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement or the like made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification.

Claims (10)

1. A compatibility detection method, comprising:
loading a main body frame of the page;
generating a detection pixel block corresponding to each image compression format to be detected;
loading the detection pixel block corresponding to the image compression format into the main body frame and rendering;
judging whether the detection pixel block corresponding to the image compression format is rendered successfully or not;
if yes, determining that the image compression format is compatible with the terminal;
if not, determining that the image compression format is incompatible with the terminal.
2. The method of claim 1, wherein the loading and rendering of the detection pixel block corresponding to the image compression format into the main body frame specifically comprises:
loading the detection pixel block corresponding to the image compression format into the main body frame;
and rendering the loaded main body frame and the detection pixel block in an off-screen canvas.
3. The method of claim 1, wherein determining whether the detected pixel block corresponding to the image compression format is rendered successfully comprises:
determining a detection pixel block corresponding to the image compression format and an element node in a document object model corresponding to the page;
and judging whether the detection pixel block corresponding to the image compression format is rendered successfully or not according to the attribute information of the element node.
4. The method of claim 3, wherein the attribute information of the element node contains at least a width-height value of the element node.
5. The method of claim 1, wherein when it is determined that the image compression format is compatible with the terminal, the method further comprises:
and aiming at the image to be rendered in the page, acquiring the image to be rendered in the image compression format, and rendering the page according to the image to be rendered in the image compression format.
6. The method of claim 1, wherein when it is determined that the image compression format is incompatible with the terminal, the method further comprises:
and aiming at the image to be rendered in the page, acquiring the image to be rendered in a default format, and rendering the page according to the image to be rendered in the default format.
7. The method of claim 1, wherein the detection pixel block is a transparent pixel block and/or the detection pixel block is a unit pixel size.
8. A compatibility detection apparatus, comprising:
a loading module configured to load a body frame of a page;
the generating module is configured to generate a detection pixel block corresponding to each image compression format to be detected;
the rendering module is configured to load the detection pixel block corresponding to the image compression format into the main body frame and render the detection pixel block;
and the judging module is configured to judge whether the rendering of the detection pixel block corresponding to the image compression format is successful, determine that the image compression format is compatible with the terminal if the rendering is successful, and determine that the image compression format is incompatible with the terminal if the rendering is not successful.
9. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method of any of the preceding claims 1 to 7.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 7 when executing the program.
CN202111128045.3A 2021-09-26 2021-09-26 Compatibility detection method and device, storage medium and electronic equipment Active CN113886228B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111128045.3A CN113886228B (en) 2021-09-26 2021-09-26 Compatibility detection method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111128045.3A CN113886228B (en) 2021-09-26 2021-09-26 Compatibility detection method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN113886228A CN113886228A (en) 2022-01-04
CN113886228B true CN113886228B (en) 2022-11-04

Family

ID=79006802

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111128045.3A Active CN113886228B (en) 2021-09-26 2021-09-26 Compatibility detection method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113886228B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9262396B1 (en) * 2010-03-26 2016-02-16 Amazon Technologies, Inc. Browser compatibility checker tool
CN108549562A (en) * 2018-03-16 2018-09-18 阿里巴巴集团控股有限公司 A kind of method and device of image load
CN111881393A (en) * 2020-07-22 2020-11-03 北京三快在线科技有限公司 Page rendering method, device, medium and electronic equipment
CN112540806A (en) * 2020-12-25 2021-03-23 北京百度网讯科技有限公司 Applet page rendering method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9262396B1 (en) * 2010-03-26 2016-02-16 Amazon Technologies, Inc. Browser compatibility checker tool
CN108549562A (en) * 2018-03-16 2018-09-18 阿里巴巴集团控股有限公司 A kind of method and device of image load
CN111881393A (en) * 2020-07-22 2020-11-03 北京三快在线科技有限公司 Page rendering method, device, medium and electronic equipment
CN112540806A (en) * 2020-12-25 2021-03-23 北京百度网讯科技有限公司 Applet page rendering method and device, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Scalable Scalable Vector Graphics: Automatic Translation of Interactive SVGs to a Multithread VDOM for Fast Rendering;Michail Schwab 等;《IEEE》;20210215;第28卷(第9期);第3219页至3233页 *
基于文档对象模型和图像处理的网页分割方法;贾柯祯;《现代计算机(专业版)》;20180315(第08期);第52页至53页 *

Also Published As

Publication number Publication date
CN113886228A (en) 2022-01-04

Similar Documents

Publication Publication Date Title
CN111639289A (en) Webpage loading method and device
KR102179149B1 (en) Page component dynamic layout
CN110489116B (en) Page rendering method and device and computer storage medium
CN111639278B (en) Webpage loading method and device
CN106294658B (en) Webpage quick display method and device
CN111796823A (en) Method and device for updating page and displaying page and page maintenance system
CN110032409B (en) Client screen adapting method and device and electronic equipment
CN110941784A (en) Page generation method and device
CN104820589B (en) A kind of method and its device of dynamic adaptation webpage
CN110496395B (en) Component operation method, system and equipment for illusion engine
CN113672323A (en) Page display method and device
CN111796821A (en) Page updating method and device
CN107479868B (en) Interface loading method, device and equipment
CN111881393A (en) Page rendering method, device, medium and electronic equipment
CN112783783A (en) Webpage point burying method, device and equipment and readable storage medium
CN112612982A (en) Webpage preloading method and device and computer equipment
CN111880990B (en) Exception handling method and device
CN111241040A (en) Information acquisition method and device, electronic equipment and computer storage medium
CN110825600B (en) Page information processing method, server and page display device
CN112035117A (en) Page display system, method and device
CN113886228B (en) Compatibility detection method and device, storage medium and electronic equipment
CN111538667A (en) Page testing method and device
CN110659372A (en) Picture input and access method, device and equipment
CN108304169B (en) Implementation method, device and equipment for HTML5 application
CN112698882A (en) Page component loading method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant