CN116340662A - Method and device for adapting browser, electronic equipment and storage medium - Google Patents

Method and device for adapting browser, electronic equipment and storage medium Download PDF

Info

Publication number
CN116340662A
CN116340662A CN202211597182.6A CN202211597182A CN116340662A CN 116340662 A CN116340662 A CN 116340662A CN 202211597182 A CN202211597182 A CN 202211597182A CN 116340662 A CN116340662 A CN 116340662A
Authority
CN
China
Prior art keywords
code
browser
information
matched
target
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.)
Pending
Application number
CN202211597182.6A
Other languages
Chinese (zh)
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202211597182.6A priority Critical patent/CN116340662A/en
Publication of CN116340662A publication Critical patent/CN116340662A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • 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/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

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

Abstract

The disclosure provides a method, a device, electronic equipment and a storage medium for adapting a browser, which can be applied to the technical field of computers. The method for adapting the browser comprises the following steps: running a first code in a first browser to generate a first running result, wherein the first code is a code matched with the first browser; determining the difference between the first browser and the second browser to obtain a difference item; updating the first code based on the difference item to obtain a second code; running a second code in a second browser to generate a second running result; and under the condition that the first operation result is matched with the second operation result, the second code is used as the target code matched with the second browser.

Description

Method and device for adapting browser, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technology, and more particularly, to a method, an apparatus, an electronic device, a storage medium, and a computer program product for adapting a browser.
Background
With the rapid development of browser products, various browsers have emerged. Different kinds of browsers are also staggered due to different loading criteria for pages of their parameter configurations. Even the same browser, the page loading standards of the new and old browsers can be different due to the fact that the version update is carried out in different periods. Therefore, it is necessary to adapt the page to the browser so that the page can be normally loaded in various browsers.
In the process of implementing the disclosed concept, the inventor finds that at least the following problems exist in the related art: the browser adapting method in the related technology is huge in labor cost, long in time consumption, easy to miss and incapable of performing rapid adaptation.
Disclosure of Invention
In view of this, the present disclosure provides a method, apparatus, electronic device, storage medium, and computer program product for adapting a browser.
One aspect of the present disclosure provides a method of adapting a browser, comprising:
running a first code in a first browser to generate a first running result, wherein the first code is a code matched with the first browser;
determining the difference between the first browser and the second browser to obtain a difference item;
updating the first code based on the difference item to obtain a second code;
running a second code in a second browser to generate a second running result;
and under the condition that the first operation result is matched with the second operation result, the second code is used as the target code matched with the second browser.
According to an embodiment of the disclosure, updating the first code based on the difference term to obtain the second code includes:
Determining a target matching rule matched with the difference item from a plurality of matching rules, wherein the target matching rule comprises predetermined standard information for representing adaptation with the second browser;
determining a target subcode from the first code based on the target matching rule;
determining whether the target subcode matches predetermined criteria information;
updating the target sub-code to generate a second code under the condition that the target sub-code is not matched with the preset standard information;
in the case where it is determined that the target sub-code matches the predetermined standard information, the first code is regarded as the second code.
According to an embodiment of the present disclosure, wherein the predetermined criterion information includes a plurality of predetermined criterion sub-information;
determining whether the target subcode matches the predetermined criteria information includes:
determining a type of the predetermined standard sub-information for each of the plurality of predetermined standard sub-information;
determining code information matched with the type from the target subcode;
determining a matching sub-result based on the code information and the preset standard sub-information to obtain a plurality of matching sub-results;
under the condition that the plurality of matching sub-results are determined to be matched with the code information and the preset standard sub-information, determining that the target sub-code is matched with the preset standard information;
In the case that the matching sub-result in which the feature code information and the predetermined standard sub-information are not matched is determined to exist among the plurality of matching sub-results, the target sub-code is determined to be not matched with the predetermined standard information.
According to an embodiment of the present disclosure, running a first code in a first browser, generating a first running result includes:
displaying a target page matched with the page path in a first browser based on the page path in the first code;
determining first format information of each of a plurality of components in a target page;
determining first structural layout information of the target page, wherein the first structural layout information is used for representing first structural layouts of the components;
in the case that the plurality of components include the functional component element, determining first functional state information of the functional component;
a first operation result is generated based on the plurality of first format information, the first structural layout information, and the first function status information.
According to an embodiment of the present disclosure, running a second code in a second browser, generating a second running result includes:
displaying a target page matched with the page path in the second browser based on the page path in the first code;
Determining second format information of each of a plurality of components in the target page;
determining second structural layout information of the target page, wherein the second structural layout information is used for representing second structural layouts of the components;
in the case that the plurality of components include the functional component element, determining second functional state information of the functional component;
the first operation result is generated based on the plurality of second format information, the second structural layout information, and the second function status information.
According to an embodiment of the present disclosure, the above method further includes:
determining whether the first format information is matched with the second format information for each component in the plurality of components to obtain a plurality of component format matching results;
determining whether the first structural layout information is matched with the second structural layout information to obtain a structural layout matching result;
determining whether the first function state information and the second function state information are matched to obtain a function state matching result;
determining that the first operation result is matched with the second operation result when the plurality of component format matching results, the structural layout matching result and the functional state matching result are determined to be all characterized in that the first operation result is matched with the second operation result;
And determining that the first operation result is not matched with the second operation result when at least one result of the plurality of component format matching results, the structural layout matching results and the functional state matching results is determined to represent that the first operation result is not matched with the second operation result.
According to an embodiment of the present disclosure, wherein the difference term comprises at least one of: kernel difference item, version difference item, additional function difference item.
Another aspect of the present disclosure provides an apparatus for adapting a browser, including:
the first generation module is used for running a first code in the first browser and generating a first running result, wherein the first code is a code matched with the first browser;
the first obtaining module is used for determining the difference between the first browser and the second browser and obtaining a difference item;
the second obtaining module is used for updating the first code based on the difference item to obtain a second code;
the second generation module is used for running a second code in a second browser and generating a second running result;
and the module is used for taking the second code as the target code matched with the second browser under the condition that the first operation result is matched with the second operation result.
Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of adapting a browser.
Another aspect of the present disclosure provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described method of adapting a browser.
Another aspect of the present disclosure provides a computer program product comprising computer executable instructions which, when executed, are adapted to implement the method of adapting a browser described above.
According to the embodiment of the disclosure, because the first code is operated in the first browser, a first operation result is generated, wherein the first code is a code which is adaptive to the first browser; determining the difference between the first browser and the second browser to obtain a difference item; updating the first code based on the difference item to obtain a second code; running a second code in a second browser to generate a second running result; under the condition that the first operation result is determined to be matched with the second operation result, the second code is used as a technical means of an object code matched with the second browser, the first operation result is obtained by operating the first code which is already matched in the first browser, the second code is obtained by updating the first code according to the difference item of the first browser and the second browser, the second operation result is obtained by operating the second code in the second browser, the object code matched with the second browser is determined according to the first operation result and the second operation result, and the first code which is already matched with the second browser can be automatically updated according to the difference item of the first browser and the second browser without manually modifying the first code, so that the technical problems that the mode of matching the browser in the related technology is high in labor cost, time consumption is long, omission is easy to occur, and quick adaptation cannot be achieved are at least partially overcome, and further the technical effect of improving the efficiency of the matched browser is achieved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments thereof with reference to the accompanying drawings in which:
FIG. 1 schematically illustrates an exemplary system architecture to which a method of adapting a browser may be applied, according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a method of adapting a browser according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates a flow chart of a method of adapting a browser according to yet another embodiment of the present disclosure;
FIG. 4 schematically illustrates a block diagram of an apparatus for adapting a browser according to an embodiment of the disclosure; and
fig. 5 schematically illustrates a block diagram of an electronic device adapted to implement the above-described method of adapting a browser, according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where expressions like at least one of "A, B and C, etc. are used, the expressions should generally be interpreted in accordance with the meaning as commonly understood by those skilled in the art (e.g.," a system having at least one of A, B and C "shall include, but not be limited to, a system having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a formulation similar to at least one of "A, B or C, etc." is used, in general such a formulation should be interpreted in accordance with the ordinary understanding of one skilled in the art (e.g. "a system with at least one of A, B or C" would include but not be limited to systems with a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the related personal information of the user all conform to the regulations of related laws and regulations, necessary security measures are taken, and the public order harmony is not violated.
In the technical scheme of the disclosure, the authorization or consent of the user is obtained before the personal information of the user is obtained or acquired.
In the related art, browser/server (B/S) architecture application refers to an application in which a front end interacts with a user by means of a browser, and a back end implements complex logic by a server. The world wide Web consortium (World Wide Web Consortium, W3C) is the most authoritative and influential international, neutral technical standard in the Web technology field. Hypertext markup language 5 level (Hyper Text Markup Language tag, HTML5) is a language description of the construction of Web content by W3C, and cascading style sheet 3 level (Cascading Style Sheets Level, CSS 3) is an upgraded version of the cascading style sheet (Cascading Style Sheets Level, CSS) technology by W3C. Nodejs is a Java language (JavaScript) runtime environment. The Node package manager (Node Package Manager, NPM) is a package management tool installed along with nodejs that can download third party packages to local use. The HTML tag is the most basic unit in the HTML language, and each module and element on the webpage correspond to each type of HTML tag.
For a long time, the browser market has been mainly occupied by 4 kinds of kernels, namely a Chrome kernel represented by a Chrome browser (abbreviated as google browser), a Trident kernel represented by a Internet Explorer browser (abbreviated as IE browser), a Gecko kernel represented by a FireFox browser (abbreviated as FireFox browser) and a Webkit kernel represented by a Safari browser. Although individual features may exist for different browser kernels, most browsers still follow the HTML5/CSS3 standard implemented by W3C.
With technology replacement and market change, the B/S application is necessarily faced with different browser adaptation scenarios, and needs to adapt different browsers with the same kernel and different kernel browsers, mainly facing the following problems: the development degree of the kernel is different, the added functions are different, the grammar and the standard are interpreted differently, so that the difference between the browsers is large, and the differences are not completely and uniformly summarized by large vendors or third party institutions; B/S application relates to the technologies of more technical stack types and complex technical details, B/S application relates to the technologies of HTML, CSS, javaScript and the like, and if browser plug-ins are used, the technologies of Java, python, an operating system and the like are also related, and the main differences are differences in grammar analysis difference, browser plug-in difference, security mechanism, performance, system compatibility and the like among various browsers.
In the related art, the traditional browser adapting mode is to check, modify and verify by the developer one by one, and a B/S application often has hundreds to thousands of pages or functions, the volume is large, the browser adapting mode one by one has huge labor cost and long time consumption, and the browser adapting mode is difficult to achieve without omission and cannot meet the requirement of rapid application adaptation.
In view of this, embodiments of the present disclosure provide a method for adapting a browser. The method comprises the steps of running a first code in a first browser to generate a first running result, wherein the first code is a code matched with the first browser; determining the difference between the first browser and the second browser to obtain a difference item; updating the first code based on the difference item to obtain a second code; running a second code in a second browser to generate a second running result; and under the condition that the first operation result is matched with the second operation result, the second code is used as the target code matched with the second browser. The first code which is already adapted in the first browser is operated in the first browser to obtain a first operation result, the first code is updated according to the difference item of the first browser and the second browser to obtain a second code, the second code is operated in the second browser to obtain a second operation result, the target code which is adapted with the second browser is determined according to the first operation result and the second operation result, the first code which is already adapted can be automatically updated according to the difference item of the first browser and the second browser, and the first code does not need to be manually modified, so that the technical problems that the mode of adapting the browser in the related art is huge in labor cost, long in time consumption, easy to occur and incapable of performing quick adaptation are at least partially overcome, and the technical effect of improving the efficiency of adapting the browser is achieved. The efficient and rapid adaptation of the browser is realized, and the workload of developers is reduced.
Fig. 1 schematically illustrates an exemplary system architecture 100 in which a method of adapting a browser may be applied, according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which embodiments of the present disclosure may be applied to assist those skilled in the art in understanding the technical content of the present disclosure, but does not mean that embodiments of the present disclosure may not be used in other devices, systems, environments, or scenarios.
As shown in fig. 1, a system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and/or wireless communication links, and the like.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. The terminal devices 101, 102, 103 may have means for adapting browsing installed thereon, and may also have various communication client applications installed thereon, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients and/or social platform software, etc. (as examples only).
The terminal devices 101, 102, 103 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (by way of example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and process the received data such as the user request, and feed back the processing result (e.g., the web page, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that, the method for adapting a browser provided in the embodiments of the present disclosure may be generally performed by the server 105. Accordingly, the device for adapting a browser provided in the embodiments of the present disclosure may be generally disposed in the server 105. The method of adapting a browser provided by the embodiments of the present disclosure may also be performed by a server or a cluster of servers other than the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the browser-adapting apparatus provided by the embodiments of the present disclosure may also be provided in a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Alternatively, the method for adapting a browser provided by the embodiment of the present disclosure may be performed by the terminal device 101, 102, or 103, or may be performed by another terminal device different from the terminal device 101, 102, or 103. Accordingly, the browser adapting apparatus provided by the embodiments of the present disclosure may also be provided in the terminal device 101, 102, or 103, or in another terminal device different from the terminal device 101, 102, or 103.
For example, the first operation result may be generated in any one of the terminal devices 101, 102, or 103 (for example, but not limited to, the terminal device 101), or generated on an external storage device and may be imported into the terminal device 101. Then, the terminal device 101 may locally perform the method for adapting a browser provided by the embodiment of the present disclosure, or send the first operation result to other terminal devices, servers, or server clusters, and perform the method for adapting a browser provided by the embodiment of the present disclosure by other terminal devices, servers, or server clusters that receive the first operation result.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 2 schematically illustrates a flow chart of a method of adapting a browser according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S201 to S205.
In operation S201, a first code is executed in a first browser, and a first execution result is generated, where the first code is a code adapted to the first browser.
According to an embodiment of the present disclosure, the first code may be a code that is adapted in advance with the first browser. Specifically, the code of the webpage which is wanted to be displayed in the first browser may be the code of the webpage.
According to the embodiments of the present disclosure, the first browser may be any type of browser, for example, an IE browser, google browser) or a Safari browser, and may also be other browsers, which are not limited herein.
According to the embodiment of the disclosure, the first code may be a code already adapted in the first browser, so that various application webpages corresponding to the first code are normally displayed in the first browser, and the first operation result may be obtained according to the operation condition of the first code and the display condition of the application webpages in the first browser. Specifically, since the first code is adapted, the first running result may be a result that the application web page is normally displayed in the first browser.
In operation S202, a difference between the first browser and the second browser is determined, resulting in a difference item.
According to the embodiment of the disclosure, the second browser may be any type of browser, for example, an IE browser, google browser or Safari browser, and may be other browsers, which are not limited herein. Specifically, the second browser may be a browser with a different model from the first browser, or may be a browser with a same model and a different version.
According to the embodiment of the disclosure, the difference between the first browser and the second browser can be a kernel difference between browsers of different kernels, a version difference between browsers of different versions of the same model, or a difference of additional functions between different browsers.
According to an embodiment of the present disclosure, the difference item may be a kernel difference item, a version difference item, an additional function difference item, or the like between the first browser and the second browser.
In operation S203, the first code is updated based on the difference item, resulting in the second code.
According to the embodiment of the disclosure, the code corresponding to the difference item may be determined in the first code and updated to obtain the second code, for example, the code corresponding to the kernel difference item may be determined in the first code and updated to obtain the second code; the code corresponding to the version difference item can be determined in the first code, and the code corresponding to the version difference item is updated to obtain a second code; the code corresponding to the additional function difference item may be determined in the first code, and the code corresponding to the additional function difference item may be updated to obtain the second code.
In operation S204, a second code is run in a second browser, generating a second run result.
According to the embodiment of the disclosure, the second browser is a browser which cannot normally display the target webpage matched with the first code, and the second browser can be any type of browser but is different from the first browser, for example, an IE browser, a google browser or a Safari browser, and can be other browsers, and is not limited herein.
According to the embodiment of the disclosure, the second operation result can be obtained according to the operation condition of the second code and the display condition of the application webpage in the second browser.
In operation S205, in case it is determined that the first operation result matches the second operation result, the second code is regarded as an object code adapted to the second browser.
According to the embodiment of the disclosure, the first operation result and the second operation result can be matched to obtain a matching result, and when the matching result represents that the first operation result is matched with the second operation result, namely, the second code can normally operate in the second browser, the second code is used as the target code matched with the second browser. Under the condition that the matching result represents that the first operation result is not matched with the second operation result, namely the second code cannot normally operate in the second browser, a developer can be notified to carry out manual confirmation.
According to the embodiment of the disclosure, because the first code is operated in the first browser, a first operation result is generated, wherein the first code is a code which is adaptive to the first browser; determining the difference between the first browser and the second browser to obtain a difference item; updating the first code based on the difference item to obtain a second code; running a second code in a second browser to generate a second running result; under the condition that the first operation result is determined to be matched with the second operation result, the second code is used as a technical means of an object code matched with the second browser, the first operation result is obtained by operating the first code which is already matched in the first browser, the second code is obtained by updating the first code according to the difference item of the first browser and the second browser, the second operation result is obtained by operating the second code in the second browser, the object code matched with the second browser is determined according to the first operation result and the second operation result, and the first code which is already matched with the second browser can be automatically updated according to the difference item of the first browser and the second browser without manually modifying the first code, so that the technical problems that the mode of matching the browser in the related technology is high in labor cost, time consumption is long, omission is easy to occur, and quick adaptation cannot be achieved are at least partially overcome, and further the technical effect of improving the efficiency of the matched browser is achieved.
According to an embodiment of the disclosure, updating the first code based on the difference term to obtain the second code includes:
determining a target matching rule matched with the difference item from a plurality of matching rules, wherein the target matching rule comprises predetermined standard information for representing adaptation with the second browser;
determining a target subcode from the first code based on the target matching rule;
determining whether the target subcode matches predetermined criteria information;
updating the target sub-code to generate a second code under the condition that the target sub-code is not matched with the preset standard information;
in the case where it is determined that the target sub-code matches the predetermined standard information, the first code is regarded as the second code.
According to an embodiment of the disclosure, the plurality of matching rules may be kernel matching rules, version matching rules or additional function matching rules, the plurality of matching rules may be stored in a remote public rule base, and the difference item may be a kernel difference item, a version difference item and an additional function difference item, wherein the kernel difference item refers to a difference existing in terms of grammar analysis of a kernel, browser plug-in and the like, where the kernel difference item is different between a first browser and a second browser; the version difference item refers to the difference that the same version of the kernel of the first browser and the kernel of the second browser are different, and the version grammar analysis, browser plug-in and the like exist; the additional functionality difference item may be a difference customized according to kernels and versions of the first browser and the second browser.
According to an embodiment of the disclosure, in a case where the difference item is a kernel difference item, determining a target matching rule matched with the difference item as a kernel matching rule, where the kernel matching rule may be stored in a kernel public rule base; in the case that the difference item is a version difference item, determining that a target matching rule matched with the difference item is a version matching rule, wherein the version matching rule can be stored in a version public rule base; in the case that the difference item is an additional function difference item, determining that the target matching rule matched with the difference item is an additional function matching rule, wherein the additional function matching rule can be stored in an additional function rule base, and the matching rule in the additional function rule base can be a rule customized by a user.
According to the embodiment of the disclosure, the code corresponding to the difference item in the first code can be determined as the target subcode according to the target matching rule matched with the difference item. For example, in the case where the difference item is a kernel difference item, a code corresponding to a syntax parsing of a kernel or a browser plug-in may be determined as a target sub-code from the first browser; in the case where the difference item is a version difference item, a code corresponding to a syntax parsing of a version or a browser plug-in may be determined as a target sub-code from the first browser. According to an embodiment of the present disclosure, the predetermined standard information may be required information for the running code in the second browser, for example, the predetermined standard information may be information in which the parsing language in the second browser is JavaScript language, the browser plug-in is Flash plug-in information, and other security mechanisms, performance processing, system compatibility information, and the like. According to an embodiment of the present disclosure, determining whether the target subcode matches the predetermined standard information may be to match the target subcode of the syntax analysis code with the syntax analysis information in the predetermined standard information, taking the first code as the second code if it is determined that the target subcode of the syntax analysis code matches the syntax analysis information in the predetermined standard information, updating the target subcode according to a variable, structure in the target subcode if it is determined that the target subcode of the syntax analysis code does not match the syntax analysis information in the predetermined standard information, generating the second code, and writing the target subcode in an annotation of the second code. The type of the difference item may be recorded according to the format of the first code update record table in table 1 below, and the file path and the file name of the target subcode, the starting line and the line number of the target subcode, and the starting line and the line number of the updated second code are also recorded.
TABLE 1 first code update record Table
Sequence number Project Description of the invention
A Code file path Location of code files
B Code file name Name of code file
C Type of difference item Kernel difference term, version difference term or additional function difference term
D Target subcode line The starting line and the number of lines of the target subcode, for example: 100, 20
E Updated code lines Updated code start line and line number, for example: 100, 20
According to an embodiment of the present disclosure, determining whether the target subcode matches the predetermined standard information may be to match the target subcode of the browser plug-in code with the syntax parsing information in the predetermined standard information, taking the first code as the second code if it is determined that the target subcode of the browser plug-in code matches the browser plug-in information in the predetermined standard information, and decompiling the target subcode if it is determined that the target subcode of the browser plug-in code does not match the browser plug-in information in the predetermined standard information, so as to determine the variable and structure in the target subcode, update the target subcode according to the variable and structure in the target subcode, generate the second code, write the target subcode in the comment of the second code, and record according to the format of table 1 as described above, which is not repeated herein.
According to an embodiment of the present disclosure, determining whether the target subcode matches the predetermined standard information may be to match the security mechanism, the performance processing, the system-compatible target subcode with the security mechanism, the performance processing, the system-compatible information in the predetermined standard information, and when it is determined that the security mechanism, the performance processing, the system-compatible target subcode matches the security mechanism, the performance processing, the system-compatible information in the predetermined standard information, the first code is used as the second code, and when it is determined that the security mechanism, the performance processing, the system-compatible target subcode does not match the security mechanism, the performance processing, the system-compatible information in the predetermined standard information, the second code is obtained by updating the target subcode according to the requirements of the second browser on the security mechanism, the performance processing, the system-compatible information of the code, and the like, and is recorded according to the format as in table 1 described above, which is not repeated herein.
According to the embodiment of the disclosure, the target subcodes are matched from the first codes according to the target matching rule, so that the target subcodes which need to be updated can be searched from the adaptive first codes without manually searching, and the updating efficiency of the first codes is improved. And by matching the target subcode with the preset standard information and determining the matching condition of the target subcode and the preset standard information, whether the target subcode needs to be updated or not can be further determined, and the accuracy of updating the first code can be improved.
According to an embodiment of the present disclosure, wherein the predetermined criterion information includes a plurality of predetermined criterion sub-information;
determining whether the target subcode matches the predetermined criteria information includes:
determining a type of the predetermined standard sub-information for each of the plurality of predetermined standard sub-information;
determining code information matched with the type from the target subcode;
determining a matching sub-result based on the code information and the preset standard sub-information to obtain a plurality of matching sub-results;
under the condition that the plurality of matching sub-results are determined to be matched with the code information and the preset standard sub-information, determining that the target sub-code is matched with the preset standard information;
in the case that the matching sub-result in which the feature code information and the predetermined standard sub-information are not matched is determined to exist among the plurality of matching sub-results, the target sub-code is determined to be not matched with the predetermined standard information.
According to the embodiment of the present disclosure, the predetermined standard sub-information may be syntax parsing sub-information, browser plug-in sub-information, additional function sub-information, etc., and may also be other sub-information, which is not limited herein.
According to an embodiment of the present disclosure, the type of the predetermined standard sub-information may be determined according to different requirement information for codes in the predetermined standard sub-information. For example, in the case where the predetermined standard sub information is the syntax parsing requirement information of the second browser, the type of the predetermined standard sub information may be a syntax parsing type; in the case that the browser plug-in requirement information of the second browser is among the predetermined standard sub-information, the type of the predetermined standard sub-information may be a syntax parsing type; in the case where the predetermined standard sub information is the requirement information of the second browser for the security mechanism, performance processing, system compatibility, and the like of the code, the type of the predetermined standard sub information may be an additional function type.
According to the embodiment of the disclosure, the target subcode can be parsed, key fields in the target subcode are obtained, code information of the target subcode is determined according to the key fields, the code information can be information of a code type of the target subcode, and the code type of the target subcode can be a syntax parsing code type, a browser plug-in code type, an additional function code type and the like. The code information may be syntax parsing code type information, browser plug-in code type information, additional function code type information.
According to an embodiment of the present disclosure, determining code information matching a type from a target sub-code may be determining a keyword from the target sub-code, matching the keyword with a type of predetermined standard sub-information, determining a matching sub-result, and determining code information for a keyword matching the matching sub-result characterizing the keyword with the predetermined standard sub-information. For example, in the case where the type of the predetermined standard sub-information is a syntax parsing type, the code information in the target sub-code that matches the syntax parsing type may be syntax parsing code type information; in the case that the type of the predetermined standard sub-information is a browser plug-in type, the code information in the target sub-code matched with the browser plug-in type may be browser plug-in code type information; in the case where the type of the predetermined standard sub-information is the additional function type, the code information in the target sub-code that matches the additional function type may be the additional function code type information.
According to the embodiment of the disclosure, in the case that the plurality of matching sub-results are determined to be matched with the predetermined standard sub-information by characterizing the code information, the target sub-code is matched with the predetermined standard information, that is, the target sub-code meets the running requirement of the second browser on the code in the target matching rule, the determined first code can be determined as the second code.
According to the embodiment of the disclosure, under the condition that the matching sub-result that the characteristic code information and the preset standard sub-information are not matched exists in the plurality of matching sub-results, the fact that the target sub-code is not matched with the preset standard information is determined, namely, the target sub-code is not in accordance with the operation requirement of the second browser on the code in the target matching rule, and the target sub-code can be updated according to the target matching rule to obtain the second code.
According to the embodiment of the disclosure, the plurality of matching sub-results are obtained by whether the code information of the target sub-code is matched with the types of the plurality of preset standard sub-information, whether the target sub-code is matched with the preset standard information can be rapidly determined according to the plurality of matching sub-results, manual one-to-one checking and verification are not needed, and the speed of adapting to the browser is improved.
According to an embodiment of the present disclosure, running a first code in a first browser, generating a first running result includes:
displaying a target page matched with the page path in a first browser based on the page path in the first code;
determining first format information of each of a plurality of components in a target page;
determining first structural layout information of the target page, wherein the first structural layout information is used for representing first structural layouts of the components;
in the case that the plurality of components include the functional component element, determining first functional state information of the functional component;
a first operation result is generated based on the plurality of first format information, the first structural layout information, and the first function status information.
According to the embodiment of the disclosure, the first browser may be set as a default browser, and in the case of running the first code in the first browser, the target page corresponding to the first code may be opened by default using the first browser.
According to the embodiment of the disclosure, the first code can be scanned, all page paths in the first code are determined, and a target page matched with the page paths is displayed in the first browser.
According to an embodiment of the present disclosure, the first format information of each of the plurality of components in the target page may be an HTML tag type, an ID or Name identification, a CSS attribute, or the like of the plurality of components.
According to an embodiment of the present disclosure, the first structural layout information may be information of a positional relationship between the plurality of components.
According to the embodiment of the disclosure, the functional component may be a component capable of being linked to other pages or capable of being clicked, the button being clicked or the linked functional component being sequentially simulated, and the first functional state information of the functional component being determined according to a module CSS style generated by the functional component of the button or a jump address of the functional component being clicked.
According to the embodiment of the disclosure, based on a plurality of first format information, first structure layout information and first function status information, a first operation result is generated, where the first operation result may be shown in a first operation result record table in table 2 below, where a line records a path of a target page, a HTML tag type of a line record component, an ID or Name identifier of a line record component, a tag CSS style of a line record component, a CSS style of a newly added component after an E line record function component is opened, a click function of an F line record function component, a link function of a G line record function component, and an address of an H line record function component link.
TABLE 2 first operation result record Table
Figure BDA0003993608970000181
According to the embodiment of the disclosure, the first code is executed in the first browser, and the first execution result is recorded, so that the first format information, the first structural layout information and the first function state information of the first code in the first browser can be recorded, and whether the second execution result meets expectations or not is determined by taking the first execution result as a reference.
According to an embodiment of the present disclosure, running a second code in a second browser, generating a second running result includes:
displaying a target page matched with the page path in a second browser based on the page path in the second code;
determining second format information of each of a plurality of components in the target page;
determining second structural layout information of the target page, wherein the second structural layout information is used for representing second structural layouts of the components;
in the case that the plurality of components include the functional component element, determining second functional state information of the functional component;
a second operation result is generated based on the plurality of second format information, the second structural layout information, and the second function status information.
According to the embodiment of the disclosure, the second browser may be set as a default browser, and in the case of running the second code in the second browser, a page corresponding to the second code may be opened using the second browser by default.
According to the embodiment of the disclosure, the second code can be scanned, all page paths in the second code are determined, and the target page matched with the page paths is displayed in the second browser.
According to an embodiment of the present disclosure, the second format information of each of the plurality of components in the target page may be HTML tag type, ID or Name identification, CSS attribute, etc. of the plurality of components.
According to an embodiment of the present disclosure, the second structural layout information may be information of a positional relationship between the plurality of components.
According to the embodiment of the disclosure, in the case that the plurality of components include the function component element, it may be that the components include a link and a function capable of clicking, the clicking button or the linked function component may be sequentially simulated, and the second function state information of the function component is determined according to the module CSS style generated by the function component of the button or the jump address of the clicked function component.
According to the embodiment of the disclosure, based on a plurality of second format information, second structure layout information and second function status information, a second operation result is generated, where the second operation result may be shown in a second operation result record table in table 3 below, where a line records a path of a target page, a HTML tag type of a line record component, an ID or Name identifier of a line record component, a tag CSS style of a line record component, a CSS style of a newly added component after an E line record function component is opened, a click function of an F line record function component, a link function of a G line record function component, and an address of an H line record function component link.
TABLE 3 second operation results record Table
Figure BDA0003993608970000201
According to the embodiment of the disclosure, a second operation result is generated according to a plurality of pieces of second format information, second structure layout information and second function state information obtained by the operation of the second code in the second browser, and the adaptation condition of the second code in the second browser can be obtained.
According to an embodiment of the present disclosure, the above method further includes:
determining whether the first format information is matched with the second format information for each component in the plurality of components to obtain a plurality of component format matching results;
determining whether the first structural layout information is matched with the second structural layout information to obtain a structural layout matching result;
determining whether the first function state information and the second function state information are matched to obtain a function state matching result;
determining that the first operation result is matched with the second operation result when the plurality of component format matching results, the structural layout matching result and the functional state matching result are determined to be all characterized in that the first operation result is matched with the second operation result;
and determining that the first operation result is not matched with the second operation result when at least one result of the plurality of component format matching results, the structural layout matching results and the functional state matching results is determined to represent that the first operation result is not matched with the second operation result.
According to the embodiment of the disclosure, the first operation result in table 2 may be compared with the second operation result in table 3, for example, the first format information and the second format information of the plurality of components respectively displayed in the first browser and the second browser may be matched, so as to obtain a plurality of component format matching results.
According to the embodiment of the disclosure, the first operation result and the second operation result are automatically verified, so that the workload of a developer is reduced, various hidden dangers caused by complicated manual operation steps are reduced, and the efficiency of adapting to the browser is remarkably improved.
According to the embodiment of the disclosure, before the target page is opened by using the first browser, basic environment checking can be performed, and since the code needs to be updated in the process of updating the first code, what development language is contained in the first browser and the second browser can be checked, and whether the corresponding development environment is ready or not can be checked. For example, regarding Java programs, it is necessary to check whether JDK is installed, and the development tools necessary for front-end development have 2: the nodejs and npm, by default, will read the development tool from the system path, and the user can also add custom paths to meet the needs of codes in different languages for the development environment. Since the first code and the second code need to be operated in the first browser and the second browser respectively to obtain the first operation result and the second operation result, whether the first browser and the second browser are installed or not needs to be detected.
Fig. 3 schematically illustrates a flow chart of a method of adapting a browser according to a further embodiment of the present disclosure.
As shown in fig. 3, the method includes operations S301 to S306.
In operation S301, an adaptation report is generated according to the matching result of the first operation result and the second operation result, whether the adaptation report is characterized by passing is determined, operation S302 is executed if the adaptation report is characterized by passing, and operation S303 is executed if the adaptation report is not characterized by passing;
in operation S302, the second code is used as an object code adapted to the second browser; performing operation S306;
in operation S303, whether the adaptation passes or not is judged by the user, if the adaptation passes, operation S304 is executed, and if the adaptation does not pass, operation S305 is executed;
in operation S304, the second code is used as an object code adapted to the second browser, and operation S306 is performed;
in operation S305, the first code is reserved for reference;
in operation S306, the adaptation is completed.
According to an embodiment of the present disclosure, in the case where the adaptation report characterizes the adaptation pass, the second code may be regarded as the target code adapted to the second browser, and the target subcode in the annotation of the second code may be deleted. If the adaptation report characterizes that the adaptation is not passed, the user can further confirm the adaptation report, and if the user judges that the adaptation is passed, the target subcodes in the second code annotation are reserved for reference of a developer; and if the user judges that the adaptation is not passed, reserving the first code, and writing the second code into the annotation of the first code for reference by a developer.
Fig. 4 schematically illustrates a block diagram of an apparatus for adapting a browser according to an embodiment of the disclosure.
As shown in fig. 4, the browser-adapting apparatus 400 includes a first generation module 410, a first obtaining module 420, a second obtaining module 430, a second generation module 440, and a serving module 450.
The first generating module 410 is configured to run a first code in a first browser, and generate a first running result, where the first code is a code adapted to the first browser;
a first obtaining module 420, configured to determine a difference between the first browser and the second browser, and obtain a difference item;
a second obtaining module 430, configured to update the first code based on the difference term, to obtain a second code;
a second generating module 440, configured to run a second code in a second browser, and generate a second running result;
and a module 450, configured to, in a case where the first operation result is determined to match the second operation result, take the second code as an object code adapted to the second browser.
According to an embodiment of the present disclosure, the second obtaining module configured to update the first code based on the difference term to obtain the second code includes:
a first obtaining sub-module, configured to determine a target matching rule matched with the difference item from a plurality of matching rules, where the target matching rule includes predetermined standard information for characterizing adaptation with the second browser;
A second obtaining sub-module for determining a target sub-code from the first code based on a target matching rule;
a third obtaining sub-module for determining whether the target sub-code matches with the predetermined standard information;
a fourth obtaining sub-module, configured to update the target sub-code and generate a second code when it is determined that the target sub-code does not match the predetermined standard information;
and fifth obtaining a sub-module, which is used for taking the first code as the second code when the target sub-code is determined to be matched with the preset standard information.
According to an embodiment of the present disclosure, wherein the predetermined criterion information includes a plurality of predetermined criterion sub-information; the third deriving submodule for determining whether the target subcode matches the predetermined criterion information includes:
a first obtaining unit configured to determine, for each of a plurality of pieces of predetermined standard sub-information, a type of the predetermined standard sub-information;
a second obtaining unit for determining code information matched with the type from the target subcode;
a third obtaining unit, configured to determine a matching sub-result based on the code information and the predetermined standard sub-information, and obtain a plurality of matching sub-results;
a fourth obtaining unit, configured to determine that the target sub-code matches the predetermined standard information when it is determined that the plurality of matching sub-results all represent the code information and the predetermined standard sub-information match;
And a fifth obtaining unit configured to determine that the target sub-code does not match the predetermined standard information, in a case where it is determined that there is a matching sub-result in which the feature code information does not match the predetermined standard sub-information among the plurality of matching sub-results.
According to an embodiment of the present disclosure, a first generating module for running a first code in a first browser and generating a first running result includes:
the first generation sub-module is used for displaying a target page matched with the page path in the first browser based on the page path in the first code;
the second generation sub-module is used for determining the first format information of each of the plurality of components in the target page;
a third generation sub-module for determining first structural layout information of the target page, wherein the first structural layout information is used for representing first structural layouts of the components;
a fourth generation sub-module for determining first function status information of the function component in a case where it is determined that the plurality of components includes the function component element;
and a fifth generation sub-module for generating a first operation result based on the plurality of first format information, the first structural layout information and the first function state information.
According to an embodiment of the present disclosure, the second generating module configured to execute the second code in the second browser and generate the second running result includes:
a sixth generation sub-module, configured to display, in the second browser, a target page that matches the page path based on the page path in the second code;
a seventh generation sub-module, configured to determine second format information of each of the plurality of components in the target page;
an eighth generation sub-module for determining second structural layout information of the target page, wherein the second structural layout information is used for representing second structural layouts of the plurality of components;
a ninth generation sub-module for determining second function status information of the function component in a case where it is determined that the function component elements are included in the plurality of components;
and a tenth generation sub-module for generating a second operation result based on the plurality of second format information, the second structural layout information, and the second function status information.
According to an embodiment of the present disclosure, the above apparatus further includes:
the third obtaining module is used for determining whether the first format information is matched with the second format information according to each component in the multiple components to obtain multiple component format matching results;
A fourth obtaining module, configured to determine whether the first structural layout information and the second structural layout information are matched, and obtain a structural layout matching result;
a fifth obtaining module, configured to determine whether the first functional state information and the second functional state information are matched, and obtain a functional state matching result;
the first determining module is used for determining that the first operation result is matched with the second operation result when determining that the plurality of component format matching results, the structural layout matching results and the functional state matching results are all characterized in that the first operation result is matched with the second operation result;
and the second determining module is used for determining that the first operation result is not matched with the second operation result when at least one result of the plurality of component format matching results, the structural layout matching results and the functional state matching results is determined.
According to an embodiment of the present disclosure, wherein the difference term comprises at least one of: kernel difference item, version difference item, additional function difference item.
Any number of modules, sub-modules, units, sub-units, or at least some of the functionality of any number of the sub-units according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented as split into multiple modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system-on-chip, a system-on-substrate, a system-on-package, an Application Specific Integrated Circuit (ASIC), or in any other reasonable manner of hardware or firmware that integrates or encapsulates the circuit, or in any one of or a suitable combination of three of software, hardware, and firmware. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be at least partially implemented as computer program modules, which when executed, may perform the corresponding functions.
For example, any of the first generation module 410, the first derivation module 420, the second derivation module 430, the second generation module 440, and the act as module 450 may be combined in one module/unit/sub-unit or any of the modules/units/sub-units may be split into multiple modules/units/sub-units. Alternatively, at least some of the functionality of one or more of these modules/units/sub-units may be combined with at least some of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to embodiments of the present disclosure, at least one of the first generation module 410, the first derivation module 420, the second derivation module 430, the second generation module 440, and the act as module 450 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or as hardware or firmware in any other reasonable manner of integrating or packaging the circuitry, or as any one of or a suitable combination of any of the three. Alternatively, at least one of the first generation module 410, the first derivation module 420, the second derivation module 430, the second generation module 440, and the as module 450 may be at least partially implemented as a computer program module that, when executed, performs the corresponding functions.
It should be noted that, in the embodiment of the present disclosure, the device portion adapted to the browser corresponds to the method portion adapted to the browser in the embodiment of the present disclosure, and the description of the device portion adapted to the browser specifically refers to the method portion adapted to the browser and is not described herein.
Fig. 5 schematically illustrates a block diagram of an electronic device adapted to implement the above-described method of adapting a browser, according to an embodiment of the present disclosure. The electronic device shown in fig. 5 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 5, an electronic device 500 according to an embodiment of the present disclosure includes a processor 501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. The processor 501 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. The processor 501 may also include on-board memory for caching purposes. The processor 501 may comprise a single processing unit or a plurality of processing units for performing different actions of the method flows according to embodiments of the disclosure.
In the RAM 503, various programs and data required for the operation of the electronic apparatus 500 are stored. The processor 501, ROM502, and RAM 503 are connected to each other by a bus 504. The processor 501 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM502 and/or the RAM 503. Note that the program may be stored in one or more memories other than the ROM502 and the RAM 503. The processor 501 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, the electronic device 500 may also include an input/output (I/O) interface 505, the input/output (I/O) interface 505 also being connected to the bus 504. The system 500 may also include one or more of the following components connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
According to embodiments of the present disclosure, the method flow according to embodiments of the present disclosure may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 501. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium described above carries one or more programs, which when executed, implement methods of adapting a browser according to embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 502 and/or RAM 503 and/or one or more memories other than ROM 502 and RAM 503 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowcharts. When the computer program product runs in a computer system, the program code is used for enabling the computer system to realize the browser adapting method provided by the embodiment of the disclosure.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 501. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed, and downloaded and installed in the form of a signal on a network medium, and/or installed from a removable medium 511 via the communication portion 509. The computer program may include program code that may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 501. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be combined in various combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (11)

1. A method of adapting a browser, comprising:
running a first code in a first browser to generate a first running result, wherein the first code is a code matched with the first browser;
determining the difference between the first browser and the second browser to obtain a difference item;
updating the first code based on the difference item to obtain a second code;
operating the second code in a second browser to generate a second operation result;
and under the condition that the first operation result is matched with the second operation result, the second code is used as the target code matched with the second browser.
2. The method of claim 1, wherein the updating the first code based on the difference term to obtain a second code comprises:
determining a target matching rule matched with the difference item from a plurality of matching rules, wherein the target matching rule comprises predetermined standard information for representing adaptation with the second browser;
determining a target subcode from the first code based on the target matching rule;
determining whether the target subcode matches the predetermined criteria information;
updating the target subcode to generate the second code under the condition that the target subcode is not matched with the preset standard information;
and in the case that the target subcode is determined to match the predetermined standard information, the first code is taken as the second code.
3. The method of claim 2, wherein the predetermined criterion information comprises a plurality of predetermined criterion sub-information;
the determining whether the target subcode matches the predetermined criteria information includes:
determining a type of the predetermined standard sub-information for each predetermined standard sub-information of the plurality of predetermined standard sub-information;
Determining code information matching the type from the target subcode;
determining a matching sub-result based on the code information and the preset standard sub-information to obtain a plurality of matching sub-results;
determining that the target sub-code matches the predetermined standard information if it is determined that the plurality of matching sub-results each represent code information and the predetermined standard sub-information match;
in the case that the matching sub-result in which the characterization code information and the predetermined standard sub-information are not matched exists in the plurality of matching sub-results, the target sub-code is determined to be not matched with the predetermined standard information.
4. The method of claim 1, wherein the running the first code in the first browser generates a first running result, comprising:
displaying a target page matched with the page path in the first browser based on the page path in the first code;
determining first format information of each of a plurality of components in the target page;
determining first structural layout information of the target page, wherein the first structural layout information is used for representing first structural layouts of the first components;
Determining first function state information of a first function component in the case that the first function component element is included in the plurality of first components;
and generating the first operation result based on a plurality of the first format information, the first structural layout information and the first function state information.
5. The method of claim 4, wherein the running the second code in the second browser generates a second running result, comprising:
displaying a target page matched with the page path in the second browser based on the page path in the second code;
determining second format information of each of a plurality of components in the target page;
determining second structural layout information of the target page, wherein the second structural layout information is used for representing second structural layouts of the components;
determining second function state information of the function component in the case that the function component element is included in the plurality of components;
and generating the second operation result based on a plurality of the second format information, the second structural layout information and the second function state information.
6. The method of claim 4 or 5, further comprising:
determining whether the first format information is matched with the second format information for each component in the plurality of components to obtain a plurality of component format matching results;
determining whether the first structural layout information is matched with the second structural layout information or not to obtain a structural layout matching result;
determining whether the first function state information and the second function state information are matched to obtain a function state matching result;
determining that the first operation result is matched with the second operation result when a plurality of component format matching results, structure layout matching results and functional state matching results are determined to be all characterized in that the first operation result is matched with the second operation result;
and determining that the first operation result is not matched with the second operation result when at least one result of the plurality of component format matching results, the structural layout matching results and the functional state matching results is determined to be the unmatched first operation result and the unmatched second operation result.
7. The method of claim 1, wherein the difference term comprises at least one of: kernel difference item, version difference item, additional function difference item.
8. An apparatus for adapting a browser, comprising:
the first generation module is used for running a first code in a first browser and generating a first running result, wherein the first code is a code matched with the first browser;
the first obtaining module is used for determining the difference between the first browser and the second browser and obtaining a difference item;
the second obtaining module is used for updating the first code based on the difference item to obtain a second code;
the second generation module is used for operating the second code in a second browser and generating a second operation result;
and the module is used for taking the second code as the target code matched with the second browser under the condition that the first operation result is matched with the second operation result.
9. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1 to 7.
10. A computer readable storage medium having stored thereon executable instructions which when executed by a processor cause the processor to implement the method of any of claims 1 to 7.
11. A computer program product comprising computer executable instructions for implementing the method of any one of claims 1 to 7 when executed.
CN202211597182.6A 2022-12-12 2022-12-12 Method and device for adapting browser, electronic equipment and storage medium Pending CN116340662A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211597182.6A CN116340662A (en) 2022-12-12 2022-12-12 Method and device for adapting browser, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211597182.6A CN116340662A (en) 2022-12-12 2022-12-12 Method and device for adapting browser, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116340662A true CN116340662A (en) 2023-06-27

Family

ID=86891882

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211597182.6A Pending CN116340662A (en) 2022-12-12 2022-12-12 Method and device for adapting browser, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116340662A (en)

Similar Documents

Publication Publication Date Title
US10613971B1 (en) Autonomous testing of web-based applications
US10635728B2 (en) Manifest-driven loader for web pages
US10152488B2 (en) Static-analysis-assisted dynamic application crawling architecture
US9864673B2 (en) Integration process management console with error resolution interface
US9081769B2 (en) Providing translation assistance in application localization
US8601438B2 (en) Data transformation based on a technical design document
US20130212116A1 (en) Metadata engine and repository
CN113419740B (en) Program data stream analysis method and device, electronic equipment and readable storage medium
CN107391528B (en) Front-end component dependent information searching method and equipment
US9645980B1 (en) Verification of native applications for indexing
Stocco et al. Clustering-aided page object generation for web testing
CN115599386A (en) Code generation method, device, equipment and storage medium
CN116594683A (en) Code annotation information generation method, device, equipment and storage medium
CN117009397A (en) Data query method, data query device, electronic equipment and storage medium
US11055365B2 (en) Mechanism for web crawling e-commerce resource pages
US10223460B2 (en) Application partial deep link to a corresponding resource
US9817801B2 (en) Website content and SEO modifications via a web browser for native and third party hosted websites
CN116382703B (en) Software package generation method, code development method and device, electronic equipment and medium
CN110717134A (en) Product description issuing method and device, storage medium and electronic equipment
CN116340662A (en) Method and device for adapting browser, electronic equipment and storage medium
CN113282285A (en) Code compiling method and device, electronic equipment and storage medium
US10585992B2 (en) Changing a language for a user session replay
CN113392311A (en) Field searching method, field searching device, electronic equipment and storage medium
US11960560B1 (en) Methods for analyzing recurring accessibility issues with dynamic web site behavior and devices thereof
US7496843B1 (en) Web construction framework controller and model tiers

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