CN112698879A - Method and device for loading source file - Google Patents

Method and device for loading source file Download PDF

Info

Publication number
CN112698879A
CN112698879A CN202011558971.XA CN202011558971A CN112698879A CN 112698879 A CN112698879 A CN 112698879A CN 202011558971 A CN202011558971 A CN 202011558971A CN 112698879 A CN112698879 A CN 112698879A
Authority
CN
China
Prior art keywords
source file
target application
application program
identifier
browser
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
CN202011558971.XA
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.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202011558971.XA priority Critical patent/CN112698879A/en
Publication of CN112698879A publication Critical patent/CN112698879A/en
Priority to PCT/CN2021/140150 priority patent/WO2022135410A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Landscapes

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

Abstract

The application discloses a method and a device for loading a source file, and belongs to the field of computers. Wherein, the method comprises the following steps: acquiring an identifier corresponding to a target application program; acquiring a first source file corresponding to the identifier; wherein the first source file is a source file missing from the target application; sending the first source file to the target application program to enable the target application program to load the first source file. By the method and the device, the problem that the source file is redundant due to the automatic source file loading mode through the plug-in the prior art is solved.

Description

Method and device for loading source file
Technical Field
The application belongs to the field of computers, and particularly relates to a method and a device for loading a source file.
Background
Front-end technology update iterations are very fast, and some new features used in the development process may not be supported in a low-version or different browser: such as the promise method; detecting that the IE browser does not support the promise method, but the method must be run in the IE browser; at this time, the browser must support the premium method, typically by introducing a piece of code that enables the browser to support the premium method, i.e., "patch" the browser, and this piece of code becomes the source file.
The following are commonly used in the industry:
automatically loading source files through a plug-in: by means of a front-end project packaging tool, the tool can provide a series of plug-ins, and the required plug-ins can be manually configured in a configuration file of a project, so that a source file is introduced during packaging. However, this solution has source file content redundancy, i.e. in a browser supporting a certain feature, the source file does not need to be introduced, but for the same item, the same configuration, the generated source file is the same, which results in source file redundancy.
Disclosure of Invention
The embodiment of the application provides a method and a device for loading a source file, which can solve the problem that the source file redundancy is caused by an automatic source file loading mode through a plug-in the prior art.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides a method for loading a source file, including: acquiring an identifier corresponding to a target application program; acquiring a first source file corresponding to the identifier; wherein the first source file is a source file missing from the target application; sending the first source file to the target application program to enable the target application program to load the first source file.
In a second aspect, an embodiment of the present application provides an apparatus for loading a source file, including: the first acquisition module is used for acquiring an identifier corresponding to the target application program; the second obtaining module is used for obtaining the first source file corresponding to the identifier; wherein the first source file is a source file missing from the target application; and the first sending module is used for sending the first source file to the target application program so as to enable the target application program to load the first source file.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instructions stored on the memory and executable on the processor, and when executed by the processor, the program or instructions implement the steps of the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a program or instructions are stored, which when executed by a processor implement the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the method according to the first aspect.
In the embodiment of the application, after the identifier of the target application program is obtained, a first source file corresponding to the identifier is obtained, and the first source file is sent to the target application program, so that the target application program loads the first source file; if the target application program is a browser, the missing source file, namely the code missing by the browser, can be obtained according to the identifier of the browser through the above manner of the embodiment of the application, and then sent to the browser, namely what source file the browser misses, the missing source file can be obtained according to the identifier, and the redundancy of the source file is avoided, so that the problem of the source file redundancy caused by the manner of automatically loading the source file through a plug-in the prior art is solved.
Drawings
FIG. 1 is a flow diagram of a method of loading a source file of an embodiment of the present application;
FIG. 2 is an alternative flow chart one of a method of loading a source file of an embodiment of the present application;
FIG. 3 is an alternative flow diagram two of a method of loading a source file of an embodiment of the present application;
FIG. 4 is a diagram illustrating the result of an apparatus for loading a source file according to an embodiment of the present application;
FIG. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 6 is an alternative structural schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the application may be practiced in sequences other than those illustrated or described herein, and that the terms "first," "second," and the like are generally used herein in a generic sense and do not limit the number of terms, e.g., the first term can be one or more than one. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
First, the relevant terms in the embodiments of the present application are explained;
polyfill: is a piece of code which provides the developer with the native functions that the developer wishes to support by the browser; when the browser does not support a certain function, the browser can support the function by introducing the polyfil, so that the problem of compatibility of the browser to front-end grammar is solved.
CDN (Content Delivery Network): an intelligent virtual network established on the basis of the existing network is built, and users can obtain required contents nearby by means of functional modules of load balancing, content distribution, scheduling and the like of a central platform by means of edge servers deployed in various places, so that network congestion is reduced, and the access response speed and hit rate of the users are improved.
User-Agent (User-Agent, UA): the system is a part in the Http protocol, belongs to a component of a header field, and is a special character string header which can identify an operating system and version, a browser rendering engine, a browser language, a browser plug-in and the like used by a client. In the network request, User-Agent is an identification for identifying the identity.
The following describes in detail a loading source file provided by the embodiments of the present application through specific embodiments and application scenarios thereof with reference to the accompanying drawings.
An embodiment of the present application provides a method for loading a source file, fig. 1 is a flowchart of the method for loading a source file according to the embodiment of the present application, and as shown in fig. 1, the method includes the steps of:
step S102, the first equipment acquires an identifier corresponding to a target application program;
step S104, the first device acquires a first source file corresponding to the identifier; the first source file is a source file which is missed by the target application program;
step S106, the first device sends a first source file to the target application program, so that the target application program loads the first source file.
Through the steps S102 to S106, after acquiring the identifier of the target application program, the first device may acquire the first source file corresponding to the identifier, and further send the first source file to the target application program, so that the target application program loads the first source file; if the target application program is a browser, the missing source file, namely the code missing by the browser, can be obtained according to the identifier of the browser through the above manner of the embodiment of the application, and then sent to the browser, namely what source file the browser misses, the missing source file can be obtained according to the identifier, and the redundancy of the source file is avoided, so that the problem of the source file redundancy caused by the manner of automatically loading the source file through a plug-in the prior art is solved.
An execution main body of the method for loading the source file in the embodiment of the present application may be a server, and specifically may be a background server, such as an edge server with a CDN function.
It should be noted that, the target application in the embodiment of the present application may be other applications besides the browser, such as office software, development tools, and the like.
In an optional implementation manner of the embodiment of the present application, the manner of acquiring the identifier corresponding to the target application program, which is referred to in step S102 of the embodiment of the present application, further may include:
step S102-11, receiving request information of a user agent UA carrying a target application program, which is sent by the target application program; wherein the request information is used for requesting a first source file;
step S102-12, responding to the request information, analyzing the UA to obtain the attribute information of the target application program;
and S102-13, generating an identifier according to the attribute information.
For the above step S102-11 to step S102-13, if the edge server with CDN function is taken as an execution subject, the process is that the edge server analyzes the UA after receiving the request information to obtain the attribute of the target application, and further generates the identification information. The edge server has the CDN function and can be deployed at a position close to the target application program, so that the missing source file can be obtained according to the identification of the target application program so as to ensure the normal use of the target application program.
It should be noted that the attribute information in the embodiment of the present application includes at least one of the following items: type information of the target application program, and version information of the target application program.
In addition, in another optional implementation manner of the embodiment of the present application, the method of the embodiment of the present application may further include:
step S108, in case of failure in resolving the UA, sending a second source file to the target application, where the second source file is a source file common to the application.
Therefore, under the condition of failed analysis, the project execution failure caused by acquiring an empty file can be avoided through the universal source file bottom.
In another optional implementation manner of the embodiment of the present application, regarding the manner of obtaining the first source file corresponding to the identifier in step S104, the method further may include:
s104-11, searching a first source file according to a preset mapping relation and an identifier; the preset mapping relation is used for indicating the mapping relation between the identification of the target application program and the source file.
As for the above step S104-11, a manner of searching for the first source file according to the preset mapping relationship and the identifier is taken as an example, if an execution subject is an edge server with a CDN function, there are two implementation manners in this application implementation, one is that the edge server caches the first source file in advance, the first source file may be searched locally according to the preset mapping relationship and the identifier directly, and the other is that the edge server does not cache the first source file, another server needs to obtain the first source file, where the another server may be a resource server, that is, the edge server needs to obtain the first source file from a resource server first and then send the first source file to a target application program.
The following exemplifies a method for loading a source file according to the embodiment of the present application, with reference to the above two cases; in the following embodiments, the station explains the present application on the edge server side with CDN function, and the other servers are resource servers.
Alternative embodiment 1
As to the manner of acquiring the identifier corresponding to the target application program involved in step S102 in the embodiment of the present application, the method further includes:
step S102-21, the edge server receives a first request message carrying UA sent by a target application program; the first request information is used for requesting a first source file;
step S102-22, the edge server responds to the first request information and sends UA to the resource server;
step S102-23, the edge server receives a first identifier sent by the resource server; the first identifier is generated by the resource server according to the attribute information of the target application program, and the attribute information is obtained by analyzing the UA by the resource server.
That is to say, after acquiring a request of the browser, the edge server with the CDN function sends the UA of the browser to the resource server, and then the resource server parses the UA to obtain attribute information of the browser, and further generates a corresponding identifier, and sends the identifier to the edge server with the CDN function. That is, the edge server does not have the capability to resolve the UA, and needs to resolve it with the resource server.
Based on the above steps S102-21 to S102-23, the manner of obtaining the first source file corresponding to the identifier in step S104 in the embodiment of the present application may further include:
step S104-11, the edge server determines whether a first source file corresponding to the first identifier can be found from local according to a first preset mapping relation; the first preset mapping relation is used for indicating the mapping relation between the identifier of the target application program and the source file;
step S104-22, under the condition that the first source file corresponding to the first identifier is found locally, the edge server acquires the first source file;
step S104-23, under the condition that the first source file corresponding to the first identifier is not found locally, the edge server sends the first identifier to the resource server;
step S104-24, the edge server receives a first source file sent by the resource server, wherein the first source file is obtained by the resource server according to the first identifier.
Through the steps S104-21 to S104-24, if the edge server does not locally have the first source file corresponding to the first identifier, the first source file needs to be acquired from the resource server, and if the edge server locally has the first source file, the first source file can be directly sent to the target application program, so that the missing source file can be acquired according to the identifier of the target application program, and the redundancy of the source file cannot be caused; in addition, the whole process does not need manual maintenance by a user, and only needs the edge server to send the first source file to the target application program after the target application program sends the request.
It should be noted that the attribute information referred to in the embodiments of the present application may include a type of the target application and/or version information of the target application.
The following describes the alternative embodiment 1 with reference to specific embodiments of examples of the present application;
the specific embodiment provides a method for differentially loading a polyfil according to a browser, wherein the browser is the target application program, and the polyfil is the first source file; as shown in fig. 2, the steps of the method include:
step S201, the browser sends a request to a CDN edge server, wherein the request is used for obtaining the polyfil content required by the current browser;
step S202, a CDN edge server receives a request of a browser, UA content of the browser is sent to a resource server deployed on the CDN, and the resource server analyzes a User-Agent to obtain browser type and version information;
step S203, the resource server generates a unique file identifier (for example, X-UA) according to the type and/or version information of the browser obtained by analysis, and then the resource server sends the identifier X-UA to the CDN;
step S204, the edge server with CDN receives the identifier X-UA returned by the resource server, and then searches for a polyfil file corresponding to the identifier X-UA in the local cache, where there are two cases:
1) if the polyfil file is not found, it indicates that the edge server with the CDN does not cache the polyfil file, and then continues to execute step S205;
2) if the edge server with the CDN finds a polyfil file in the local cache, directly execute step S210;
step S205, the resource server receives the identifier X-UA sent by the edge server with CDN, then the resource server analyzes and processes according to the X-UA identifier, determines which capabilities are missing from the current browser, and which polyfil contents need to be requested to support the capabilities, and then drags the corresponding polyfil contents from a polyfil database;
step S206, the resource server receives the polyfile contents dynamically returned by the polyfile database, and then merges and packages the polyfile contents into a final file (defined as X-polyfile-UA), wherein the final file is a polyfile which is finally needed by the browser and can be executed in the browser;
step S207, the resource server generates an X-polyfil-UA file and backups the X-polyfil-UA file locally;
step S208, the resource server returns the X-polyfil-UA file to the edge server with the CDN, and the edge server with the CDN stores the mapping relation between the identifier X-UA and the file X-polyfil-UA, so that the corresponding polyfil file name can be quickly found according to the X-UA;
step S209, according to the file name obtained by the mapping relation, quickly obtaining the file content from the cache;
step S210, the edge server with CDN sends the obtained executable file X-polyfil-UA to the browser, and the browser can directly execute the X-polyfil-UA file.
Through the steps S201 to S210, the X-polyfil-UA file analyzes which polyfil contents are needed at present according to the browser type and version information and the User-Agent characteristics of the browser, and then the needed polyfil contents are combined and packaged without content redundancy. In addition, in the embodiment of the application, only one fixed polyfil file link needs to be introduced into the project file, and manual maintenance is not needed. In addition, the CDN content cache and the content delivery capacity are fully utilized, and the polyfil file cache is performed on the CDN, so that the requests are reduced, and the loading performance is improved.
Alternative embodiment 2
As to the manner of acquiring the identifier corresponding to the target application program involved in the step S102, the method may further include:
step S102-31, an edge server with CDN receives second request information carrying UA sent by a target application program; the second request information is used for requesting the first source file;
step S102-32, responding to the second request information, the edge server with the CDN analyzes the UA to obtain the attribute information of the target application program;
and S102-33, the edge server with the CDN generates a second identifier corresponding to the target application program according to the attribute information of the target application program.
Through the above steps S102-31 to S102-33, the edge server with CDN may parse the UA of the target application to obtain the corresponding second identifier by itself, without using a second device.
Based on this, the manner of acquiring the first source file corresponding to the identifier in step S104 in the embodiment of the present application may further include:
step S104-31, the edge server with the CDN locally acquires a first source file according to a second preset mapping relation and a second identifier; and the second preset mapping relation is used for indicating the mapping relation between the identifier of the target application program and the source file.
It should be noted that, before the edge server with the CDN locally obtains the first source file according to the second preset mapping relationship and the second identifier, the method of the embodiment of the present application may further include:
step S11, the edge server with CDN sends the second label to the resource server;
step S12, receiving, by an edge server with a CDN, a first source file sent by a resource server, where the first source file is obtained by the resource server according to a second identifier;
in step S13, the edge server with the CDN caches the first source file locally.
Through the above steps S11 to S13, since the edge server with the CDN can resolve the UA of the target application by itself, the first source file missing from the edge server with the CDN can be cached locally on the edge server with the CDN; thus, after the edge server with the CDN resolves the UA to obtain the access identifier, the first source file may be found locally according to the preset mapping relationship, that is, the found source file is the source file missing from the target application, and redundancy of the source file is not caused.
The alternative embodiment 2 will be described below by way of example with reference to specific embodiments of examples of the present application. The specific embodiment provides a method for differentially loading a polyfil according to a browser, wherein the browser is the target application program, and the polyfil is the first source file; as shown in fig. 3, the steps of the method include:
the browser first request step comprises the following steps:
step S301, the browser sends a request to an edge server with a CDN to acquire the polyfil content required by the current browser;
step S302, a set of analysis rules is locally configured on an edge server with a CDN, the characteristics of a browser User-Agent can be directly analyzed, and then an identifier X-UA is generated according to the analyzed browser type and version information;
step S303, the edge server with CDN sends the generated identifier X-UA to a resource server to request to acquire a polyfil file required by a browser corresponding to the identifier X-UA;
step S304, the resource server receives an identifier X-UA sent by an edge server with a CDN, then the server performs analysis processing according to the X-UA identifier, determines which capabilities are missing from the current browser, and which polyfil contents need to be requested to support the capabilities, and then drags the corresponding polyfil contents from a polyfil database;
step S305, the resource server receives the polyfile contents dynamically returned by the polyfile database, and then merges and packages the polyfile contents into a final file (defined as X-polyfile-UA), wherein the final file is a polyfile which is finally needed by the browser and can be executed in the browser;
step S306, the resource server generates an X-polyfil-UA file and backups the file locally;
step S307, the resource server returns the X-polyfil-UA file to the edge server with the CDN, and the edge server with the CDN stores the mapping relation between the identifier X-UA and the file X-polyfil-UA, so that the corresponding polyfil file name can be quickly found according to the X-UA;
step S308, the edge server with CDN stores the X-polyfil-UA content, and the function is to quickly acquire the file content from the cache according to the file name obtained by the mapping relation 207;
step S309, the edge server with CDN sends the obtained executable file X-polyfil-UA to the browser, the browser can directly execute the X-polyfil-UA file, and the browser first request process response is ended;
the browser requests for the second time:
step S310, the browser sends a request to an edge server with the CDN to acquire the polyfil content required by the current browser;
step S311, obtaining an identifier X-UA locally through regular expression analysis on an edge server with a CDN;
step S312, the edge server with CDN searches the corresponding polyfil file name in the mapping relation table cached in the step S307 according to the identifier X-UA, and then searches the file content in the file cache in the step S308 according to the file name;
in step S313, the edge server with CDN returns the polyfil file needed by the browser found in S312 to the browser.
It can be seen that the request and processing of the resource server are not involved in the second request, and the response time and the system performance are greatly improved.
In addition, in this embodiment, a set of parsing rule formulas is locally configured on the CDN, a User-Agent characteristic of the browser is parsed through the rule, then a mapping relationship between an identifier generated after parsing and a corresponding polyfil file is stored, and a resource server is deployed on each CDN in optional embodiment 1, which may be deployed only if the CDN agrees; in alternative embodiment 2, by using the configuration that the CDN locally already supports the parsing rule, only one set of resource servers may be locally deployed to process the merging of the polyfil files, and there is no need to directly deploy a resource server on each CDN.
It should be noted that, in the method for loading a source file provided in the embodiment of the present application, the execution main body may be a device for loading a source file, or a control module in the device for loading a source file, which is used for executing the method for loading a source file. In the embodiments of the present application, a method for executing a source file by a source file loading apparatus is taken as an example, and an apparatus for loading a source file provided in the embodiments of the present application is described.
An embodiment of the present application provides an apparatus for loading a source file, fig. 4 is a schematic structural diagram of the apparatus for loading a source file according to the embodiment of the present application, and as shown in fig. 4, the apparatus includes:
a first obtaining module 42, configured to obtain an identifier corresponding to the target application;
a second obtaining module 44, configured to obtain the first source file corresponding to the identifier; the first source file is a source file which is missed by the target application program;
a first sending module 46, configured to send the first source file to the target application, so that the target application loads the first source file.
By the device, after the identifier of the target application program is obtained, the first source file corresponding to the identifier is obtained, and the first source file is sent to the target application program, so that the target application program loads the first source file; if the target application program is a browser, the missing source file, namely the code missing by the browser, can be obtained according to the identifier of the browser through the above manner of the embodiment of the application, and then sent to the browser, namely what source file the browser misses, the missing source file can be obtained according to the identifier, and the redundancy of the source file is avoided, so that the problem of the source file redundancy caused by the manner of automatically loading the source file through a plug-in the prior art is solved.
In an optional implementation manner of the embodiment of the present application, the first obtaining module 42 in the embodiment of the present application further includes: the receiving submodule is used for receiving request information of a user agent UA which carries a target application program and is sent by the target application program; wherein the request information is used for requesting a first source file; the analysis submodule is used for responding to the request information and analyzing the UA to obtain attribute information of the target application program; and the generation submodule is used for generating an identifier according to the attribute information.
In an optional implementation manner of the embodiment of the present application, the second obtaining module in the embodiment of the present application further includes: the searching submodule is used for searching the first source file according to the preset mapping relation and the identifier; the preset mapping relation is used for indicating the mapping relation between the identification of the target application program and the source file.
In an optional implementation manner of the embodiment of the present application, the attribute information in the embodiment of the present application includes at least one of the following: type information of the target application program, and version information of the target application program.
In an optional implementation manner of the embodiment of the present application, the apparatus in the embodiment of the present application may further include: and the second sending module is used for sending a second source file to the target application program under the condition that the UA analysis fails, wherein the second source file is a source file common to all the application programs.
The device for loading the source file in the embodiment of the present application may be a device, or may be a component, an integrated circuit, or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiments of the present application are not particularly limited.
The device for loading the source file in the embodiment of the present application may be a device having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The device for loading a source file provided in the embodiment of the present application can implement each process implemented by the method embodiment of fig. 1, and is not described here again to avoid repetition.
Optionally, as shown in fig. 5, an electronic device 500 is further provided in this embodiment of the present application, and includes a processor 501, a memory 502, and a program or an instruction stored in the memory 502 and executable on the processor 501, where the program or the instruction is executed by the processor 501 to implement each process of the above method embodiment for loading a source file, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
It should be noted that the electronic device in the embodiment of the present application includes the mobile electronic device and the non-mobile electronic device described above.
Fig. 6 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 600 includes, but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, a processor 610, and the like.
Those skilled in the art will appreciate that the electronic device 600 may further comprise a power source (e.g., a battery) for supplying power to the various components, and the power source may be logically connected to the processor 610 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The electronic device structure shown in fig. 6 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those in fig. 6, or combine some components, or arrange different components, and thus, the description thereof is omitted.
The processor 610 is configured to obtain an identifier corresponding to a target application; and obtaining a first source file corresponding to the identifier; the first source file is a source file which is missed by the target application program;
the radio frequency unit 601 is configured to send the first source file to the target application program, so that the target application program loads the first source file.
Through the electronic equipment of the embodiment of the application, after the identification of the target application program is obtained, the first source file corresponding to the identification is obtained, and the first source file is sent to the target application program, so that the target application program loads the first source file; if the target application program is a browser, the missing source file, namely the code missing by the browser, can be obtained according to the identifier of the browser through the above manner of the embodiment of the application, and then sent to the browser, namely what source file the browser misses, the missing source file can be obtained according to the identifier, and the redundancy of the source file is avoided, so that the problem of the source file redundancy caused by the manner of automatically loading the source file through a plug-in the prior art is solved.
The radio frequency unit 601 is further configured to receive request information of a user agent UA carrying a target application program, sent by the target application program; wherein the request information is used for requesting a first source file;
the processor 610 is further configured to, in response to the request information, parse the UA to obtain attribute information of the target application, and generate an identifier according to the attribute information.
The processor 610 is further configured to search the first source file according to the preset mapping relationship and the identifier; the preset mapping relation is used for indicating the mapping relation between the identification of the target application program and the source file.
The radio frequency unit 601 is further configured to send a second source file to the target application program under the condition that the UA parsing fails, where the second source file is a source file that is common to the application programs.
It is to be understood that, in the embodiment of the present application, the input Unit 604 may include a Graphics Processing Unit (GPU) 6041 and a microphone 6042, and the Graphics Processing Unit 6041 processes image data of a still picture or a video obtained by an image capturing apparatus (such as a camera) in a video capturing mode or an image capturing mode. The display unit 606 may include a display panel 6061, and the display panel 6061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 607 includes a touch panel 6071 and other input devices 6072. A touch panel 6071, also referred to as a touch screen. The touch panel 6071 may include two parts of a touch detection device and a touch controller. Other input devices 6072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein. The memory 609 may be used to store software programs as well as various data including, but not limited to, application programs and an operating system. The processor 610 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 610.
The embodiment of the present application further provides a readable storage medium with a readable storage medium removed, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the embodiment of the method for loading a source file, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and so on.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement each process of the method for loading a source file, and can achieve the same technical effect, and in order to avoid repetition, the description is omitted here.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (12)

1. A method of loading a source file, comprising:
acquiring an identifier corresponding to a target application program;
acquiring a first source file corresponding to the identifier; wherein the first source file is a source file missing from the target application;
sending the first source file to the target application program to enable the target application program to load the first source file.
2. The method of claim 1, wherein obtaining the identifier corresponding to the target application comprises:
receiving request information of a User Agent (UA) carrying the target application program, which is sent by the target application program; wherein the request information is used for requesting the first source file;
responding to the request information, analyzing the UA to obtain attribute information of the target application program;
and generating the identifier according to the attribute information.
3. The method of claim 2, wherein obtaining the first source file corresponding to the identification comprises:
searching the first source file according to a preset mapping relation and the identifier; the preset mapping relation is used for indicating the mapping relation between the identifier of the target application program and the source file.
4. The method of claim 2, wherein the attribute information comprises at least one of: the type information of the target application program and the version information of the target application program.
5. The method of claim 2, further comprising:
and sending a second source file to the target application program under the condition that the UA analysis fails, wherein the second source file is a source file which is common to the application programs.
6. An apparatus for loading a source file, comprising:
the first acquisition module is used for acquiring an identifier corresponding to the target application program;
the second obtaining module is used for obtaining the first source file corresponding to the identifier; wherein the first source file is a source file missing from the target application;
and the first sending module is used for sending the first source file to the target application program so as to enable the target application program to load the first source file.
7. The apparatus of claim 6, wherein the first obtaining module comprises:
the receiving submodule is used for receiving the request information of the user agent UA carrying the target application program, which is sent by the target application program; wherein the request information is used for requesting the first source file;
the analysis submodule is used for responding to the request information and analyzing the UA to obtain attribute information of the target application program;
and the generation submodule is used for generating the identifier according to the attribute information.
8. The apparatus of claim 6, wherein the second obtaining module comprises:
the searching submodule is used for searching the first source file according to a preset mapping relation and the identifier; the preset mapping relation is used for indicating the mapping relation between the identifier of the target application program and the source file.
9. The apparatus of claim 7, wherein the attribute information comprises at least one of: the type information of the target application program and the version information of the target application program.
10. The apparatus of claim 7, further comprising:
and the second sending module is used for sending a second source file to the target application program under the condition that the UA analysis fails, wherein the second source file is a source file common to all the application programs.
11. An electronic device comprising a processor, a memory, and a program or instructions stored on the memory and executable on the processor, which when executed by the processor, implement the steps of a method of loading a source file as claimed in any one of claims 1 to 5.
12. A readable storage medium on which is stored a program or instructions which, when executed by a processor, carry out the steps of a method of loading a source file according to any of claims 1 to 5.
CN202011558971.XA 2020-12-25 2020-12-25 Method and device for loading source file Pending CN112698879A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011558971.XA CN112698879A (en) 2020-12-25 2020-12-25 Method and device for loading source file
PCT/CN2021/140150 WO2022135410A1 (en) 2020-12-25 2021-12-21 Method and apparatus for loading source file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011558971.XA CN112698879A (en) 2020-12-25 2020-12-25 Method and device for loading source file

Publications (1)

Publication Number Publication Date
CN112698879A true CN112698879A (en) 2021-04-23

Family

ID=75510295

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011558971.XA Pending CN112698879A (en) 2020-12-25 2020-12-25 Method and device for loading source file

Country Status (2)

Country Link
CN (1) CN112698879A (en)
WO (1) WO2022135410A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022135410A1 (en) * 2020-12-25 2022-06-30 维沃移动通信有限公司 Method and apparatus for loading source file

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8655944B2 (en) * 2010-10-05 2014-02-18 Microsoft Corporation Website compatibility shims
CN109325195B (en) * 2018-07-23 2020-10-13 招银云创(深圳)信息技术有限公司 Rendering method and system for browser, computer device and computer storage medium
CN110851194A (en) * 2018-08-01 2020-02-28 北京京东尚科信息技术有限公司 Method and device for acquiring code for realizing new interface
CN112214703B (en) * 2019-07-10 2023-11-07 腾讯科技(深圳)有限公司 Webpage loading method, webpage loading device, computer readable storage medium and computer equipment
CN111800461A (en) * 2020-05-27 2020-10-20 深圳壹账通智能科技有限公司 Script downloading method, device, equipment and storage medium of browser
CN111984892A (en) * 2020-08-27 2020-11-24 网易(杭州)网络有限公司 Page access method, device, equipment and storage medium
CN112698879A (en) * 2020-12-25 2021-04-23 维沃移动通信有限公司 Method and device for loading source file

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022135410A1 (en) * 2020-12-25 2022-06-30 维沃移动通信有限公司 Method and apparatus for loading source file

Also Published As

Publication number Publication date
WO2022135410A1 (en) 2022-06-30

Similar Documents

Publication Publication Date Title
CN111222062B (en) Applet running method and device, electronic equipment and storage medium
CN106936793B (en) Information interception processing method and terminal
US9846699B2 (en) System and methods thereof for dynamically updating the contents of a folder on a device
CN102333122B (en) Downloaded resource provision method, device and system
CN108345543B (en) Data processing method, device, equipment and storage medium
CN111414407A (en) Data query method and device of database, computer equipment and storage medium
CN110020293B (en) Multimedia data display method, device and storage medium
CN104965842A (en) Search recommending method and apparatus
WO2012094965A1 (en) Method, terminal and server for presenting prompt message
US20140074814A1 (en) Method and apparatus for switching search engine to repeat search
CN112698879A (en) Method and device for loading source file
CN103440281A (en) Method, device and equipment for acquiring download file
CN104182402A (en) Browser interface address bar input control method and browser interface address bar input control system
EP2998885A1 (en) Method and device for information search
CN110928547A (en) Public file extraction method, device, terminal and storage medium
CN114253441B (en) Method and device for enabling target function, storage medium and electronic device
CN115827437A (en) Static code analysis method and device, electronic equipment, readable storage medium and chip
CN105701231A (en) Network resource search system and method
CN115599669A (en) Debugging method and device of microservice, electronic equipment and readable storage medium
CN109710604A (en) Data processing method, device, system, computer readable storage medium
CN114860295A (en) Resource file updating method, device, equipment and readable storage medium
CN111488286B (en) Method and device for independently developing Android modules
CN104794165B (en) A kind of webpage representation method, apparatus and system
WO2014062209A1 (en) System and methods thereof for dynamically updating the contents of a folder on a device
CN113836405B (en) Information query method, device and computer readable storage medium

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