WO2016177341A1 - Procédé et dispositif d'appel d'interface, et terminal - Google Patents
Procédé et dispositif d'appel d'interface, et terminal Download PDFInfo
- Publication number
- WO2016177341A1 WO2016177341A1 PCT/CN2016/081184 CN2016081184W WO2016177341A1 WO 2016177341 A1 WO2016177341 A1 WO 2016177341A1 CN 2016081184 W CN2016081184 W CN 2016081184W WO 2016177341 A1 WO2016177341 A1 WO 2016177341A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- interface
- target
- browser
- interface function
- browser kernel
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
Definitions
- the present invention relates to the field of computer technologies, and in particular, to an interface calling method, apparatus, and terminal.
- the browser has become one of the necessary application software on the mobile terminal.
- the browser kernel interprets the webpage syntax and renders the webpage.
- the browser kernel provides a large number of interfaces, and the client script can call these interfaces.
- the browser interprets the client scripts loaded in the execution webpage, thereby realizing the dynamic display effect of the webpage and enhancing the interactivity of the webpage.
- the browser includes at least two browser kernels.
- the interface functions provided between different browser kernels may differ.
- different browser kernels have different parameters for the interface functions designed by interface A that implement the same function, and the order of parameters is different, or one browser kernel in the browser provides interface B, and another browser kernel. This interface B is not provided.
- extensions and web pages in existing browsers are developed based on a particular browser kernel, client-side scripts in web pages and extensions are also developed based on that particular browser kernel. Therefore, the client script can run normally on that particular browser kernel.
- the embodiment of the invention provides an interface calling method, device and terminal, which can improve browser compatibility.
- an embodiment of the present invention provides an interface calling method, including:
- the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script
- the browser kernel currently running in the browser is not the target browser kernel corresponding to the client script
- the first interface function corresponding to the interface identifier provided by the currently running browser kernel and the target browsing Kernel Obtaining a target interface function of the currently running browser kernel corresponding to the preset interface identifier when the second interface function corresponding to the interface identifier is different, and the target interface function is according to the target
- the second interface function provided by the browser kernel performs a preset third interface function corresponding to the currently running browser kernel
- the target interface function is invoked by using the parameter as an input parameter of the target interface function.
- the client script is a script program included in an extension in the browser
- the method further includes:
- the client script corresponding to the extension that needs to be loaded in the browser is inserted into the webpage to be opened.
- the extension further includes a main program loaded in a browser
- the receiving interface calls an instruction, where the interface calling instruction carries an interface identifier and a parameter corresponding to an interface that needs to be invoked by the client script, the method further includes:
- a new process is started to load the main program, and the target browser kernel is loaded in the new process.
- the browser kernel currently running in the browser is not the target browser kernel corresponding to the client script, and the currently running Obtaining, by the browser kernel, a first interface function corresponding to the interface identifier and a second interface function corresponding to the interface identifier provided by the target browser kernel, obtaining a preset corresponding to the interface identifier
- the target interface function of the currently running browser kernel includes:
- the interface identifier is queried from the preset information base according to the interface function of the currently running browser kernel;
- the parameter is used as an input parameter of the target interface function
- the method further includes:
- an embodiment of the present invention provides an interface calling device, where the device is applied to a browser, including:
- a receiving module configured to receive an interface call instruction, where the interface call instruction carries a load client script that needs to be called Interface identifier and parameters corresponding to the interface;
- a determining module configured to: when the currently running browser kernel in the browser is not the target browser kernel corresponding to the client script, and the first interface function corresponding to the interface identifier provided by the currently running browser kernel Obtaining, by the target browser kernel, a second interface function corresponding to the interface identifier, acquiring a target interface function of the currently running browser kernel corresponding to the preset interface identifier, where the target The interface function is a third interface function corresponding to the currently running browser kernel according to the second interface function provided by the target browser kernel;
- the calling module is configured to invoke the parameter as the input parameter of the target interface function, and invoke the target interface function.
- the client script is a script program included in the extension in the browser, and the device further includes:
- the inserting module is configured to insert a client script corresponding to the extension that needs to be loaded in the browser into the webpage to be opened when the triggering event of opening the webpage is detected.
- the extension further includes a main program loaded in a browser, the device further comprising:
- the startup module is configured to start a new process to load the main program when the trigger instruction for loading the extension is received, and the target browser kernel is loaded in the new process.
- the determining module is specifically configured to:
- the interface identifier is queried from the preset information base according to the interface function of the currently running browser kernel;
- the device further includes:
- a return module for returning a result of the call of the target interface function.
- an embodiment of the present invention provides a terminal, including any one of the interface calling devices described above.
- the embodiment of the present invention receives an interface call instruction, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script; when the currently running browser kernel in the browser is not the client script corresponding to a target browser kernel, and the first interface function corresponding to the interface identifier provided by the currently running browser kernel and the second interface function provided by the target browser kernel corresponding to the interface identifier are different Obtaining, by the preset interface identifier, a target interface function of the currently running browser kernel; using the parameter as a The input parameter of the target interface function is called, and the target interface function is called.
- the interface functions provided by some interfaces are different, and the interface functions that can be replaced are preset, so that whether the currently running browser kernel is a client or not
- the target browser kernel corresponding to the script the browser can normally execute the client script to call the request of the interface with different parts, thereby avoiding the running error of the client script when calling the interface with the difference, and improving the browser. Compatibility.
- an embodiment of the present invention provides a terminal, including a processor and a memory that stores instructions executable by the processor.
- the processor is configured to: receive an interface call instruction, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script; when the currently running browser kernel in the browser is not the target corresponding to the client script a browser kernel, and the first interface function corresponding to the interface identifier provided by the currently running browser kernel and the second interface function provided by the target browser kernel corresponding to the interface identifier are different, Obtaining, by the preset interface identifier, a target interface function of the currently running browser kernel, where the target interface function is preset according to the second interface function provided by the target browser kernel Determining a third interface function corresponding to the currently running browser kernel; using the parameter as an input parameter of the target interface function, calling the target interface function.
- an embodiment of the present invention provides a computer readable storage medium having instructions stored therein, and when a processor of a terminal executes the instruction, the terminal executes an interface calling method as described above.
- an embodiment of the present invention provides a computer program that, when run on a processor, performs the interface calling method as described above.
- FIG. 1 is a schematic flowchart of an interface calling method according to an embodiment of the present invention.
- FIG. 2 is another schematic flowchart of an interface calling method according to an embodiment of the present invention.
- FIG. 3 is a schematic structural diagram of an interface calling apparatus according to an embodiment of the present invention.
- FIG. 4 is another schematic structural diagram of an interface calling apparatus according to an embodiment of the present invention.
- FIG. 5 is a schematic structural diagram of a terminal according to an embodiment of the present disclosure.
- FIG. 6 is still another schematic structural diagram of an interface calling apparatus according to an embodiment of the present invention.
- the embodiment of the invention provides an interface calling method, device and terminal, and receives an interface calling instruction, where the interface calling instruction carries an interface identifier and a parameter corresponding to an interface that needs to be invoked by the client script; when the browser is currently running
- the browser kernel is not the target browser kernel corresponding to the client script, and the interface identifier is determined when the interface function corresponding to the interface identifier provided by the currently running browser kernel and the target browser kernel respectively is different.
- the target interface function is a preset interface function; and the parameter is used as an input parameter of the target interface function, and the target interface function is called.
- the interface functions provided by some interfaces are different, and the interface functions that can be replaced are preset, so that whether the currently running browser kernel is a client or not
- the target browser kernel corresponding to the script the browser can normally execute the client script to call the request of the partial difference interface, thereby avoiding the running error of the client script when calling the part of the difference interface, and improving the compatibility of the browser.
- the interface calling method, device and terminal provided by the embodiment of the present invention are respectively described in detail below with reference to FIG.
- FIG. 1 is a schematic flowchart of a method for invoking an interface according to an embodiment of the present invention.
- the method may include the following steps.
- S101 Receive an interface call instruction, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script.
- the method may be used in a browser on a terminal or a browser-like product
- the terminal may be a terminal such as a computer, an IPAD, a mobile phone, or other smart device, specifically, the present invention.
- the embodiment of the invention is not limited at all.
- the browser provides a large number of standard interfaces to the webpage for the client script to be loaded in the webpage, and the browser interprets and executes the client script. For example, when the browser receives the interface call instruction of the client script, the browser runs the interface function corresponding to the target interface specified by the information according to the information carried by the interface call instruction, thereby implementing the corresponding function.
- commonly used browser kernels include: Trident kernel, blink kernel, Gecko kernel, etc.
- interface functions provided between different browser kernels may be different. For convenience of description, this part of the embodiment of the present invention The interface corresponding to the interface function that has the difference is called the difference interface.
- different browser kernels have different parameter parameters and parameter delivery order for interface function designed for interface A that implements the same function, or a browser kernel provides interface B, and another browser kernel does not provide the same. Interface B. Since extensions and web pages in existing browsers are developed based on a particular browser kernel, client-side scripts in web pages and extensions are also developed based on that particular browser kernel. Therefore, the client script can be normal Runs on that particular browser kernel, and when the browser kernel currently running in the browser is not the specific browser kernel, a runtime error may occur.
- browsers are mostly multi-core browsers, that is, browsers include at least two browser kernels.
- the embodiment of the present invention takes a dual-core browser as an example.
- the present invention can be applied to any browser, such as a single-core browser, a multi-core browser, and specifically, the embodiment of the present invention is not limited.
- the interface call instruction is received, and the interface call instruction carries an interface identifier and a parameter corresponding to the interface that the client script needs to invoke.
- the interface identifier may be an interface name or an identifier that is unique to the interface name.
- the embodiment of the present invention does not limit the present invention.
- the browser kernel currently running in the browser is not the target browser kernel corresponding to the client script, and the first interface function corresponding to the interface identifier provided by the currently running browser kernel and the And obtaining, by the target browser, a second interface function corresponding to the interface identifier, acquiring a target interface function of the currently running browser kernel corresponding to the preset interface identifier, where the target interface function is Presetting a third interface function corresponding to the currently running browser kernel according to the second interface function provided by the target browser kernel.
- an interface function for replacing the difference interface is preset.
- the browser is a dual-core browser, which is a Trident kernel and a blink kernel respectively. It can be seen that in the interfaces provided by the Trident kernel and the blink kernel respectively, for the interface that implements the same function, if the Trident kernel and the blink kernel are directed to the interface, The calling interface of the provided interface function is the same, regardless of whether the currently running browser kernel is the target browser kernel corresponding to the client script, the browser can normally run the client script to call the interface request.
- the Trident kernel and the blink kernel differs as follows: the Trident kernel and the blink kernel have different calling specifications for the interface functions provided by the same function (such as the interface name, the number of parameters, the order of delivery, etc.), or A kernel provides an interface to implement a function, and another core does not provide an interface to implement the function. In these cases, if the client script calls this part of the difference interface, a running error will occur.
- the embodiment of the present invention provides an interface calling method for the defect in the existing method, even if the browser kernel currently running in the browser and the browser kernel corresponding to the client script respectively provide an interface for the interface to be called by the client script.
- the client script can still be loaded normally, thereby improving browser compatibility.
- the browser is a dual-core browser, which is a Trident kernel and a blink kernel respectively.
- the target browser kernel corresponding to the client script is a blink kernel
- the currently running browser kernel is a Trident kernel, respectively, in the blink kernel and the Trident kernel.
- there is one difference interface which is represented by interface A.
- the interface function provided by the blink kernel for interface A is InterfaceA, within Trident.
- the interface function provided by the core for interface A is TridentInterfaceA
- the code for calling interface A (see InterfaceA in code 1) in the client script can be as shown in code 1
- the calling specification of the interface function provided by Trident kernel for interface A can be as Code 2 is shown.
- This interface accepts two parameters, the first parameter is the number of times, the second parameter is the URL
- This interface accepts three parameters, the first parameter is the URL, the second parameter is the number of times, the third parameter is the current time
- the interface function InterfaceA provided by the blink kernel receives two parameters, the first parameter represents the number of times, and the second parameter represents The interface function TridentInterfaceA provided by the Trident kernel receives 3 parameters, the first parameter represents the URL, the second parameter represents the number of times, and the third parameter represents the current time. Therefore, if the target browser kernel calls the interface provided by the Trident kernel for the client script of the blink kernel in accordance with the call specification provided by the blink kernel, a runtime error will occur.
- the interface function for replacement is preset. Specifically, according to the interface function provided by one of the browser kernels, a replacement function of another browser kernel is set. For example, for the interface function TridentInterfaceA provided by the Trident kernel, a replacement interface function FakeInterfaceA is preset, wherein the interface function FakeInterfaceA for replacement can be a rewritten interface function, or can be obtained by processing the existing interface function TridentInterfaceA. Interface function.
- the embodiment of the present invention is not limited according to the actual needs.
- the interface function FakeInterfaceA can be as shown in code 3.
- the target browser kernel corresponding to the client script is the blink kernel, and the currently running browser kernel is the Trident kernel, then the preset interface is run.
- the function FakeInterfaceA is the function FakeInterfaceA.
- the interface function provided by the blink kernel for interface A is InterfaceA
- the Trident kernel does not provide interface A. That is, the Trident kernel does not provide an interface function that implements the function corresponding to interface A, and the client script calls interface A (see The code for InterfaceA in Code 1 can be as shown in Code 1.
- a browser kernel provides the interface for an interface, that is, the kernel provides an interface function that implements the function corresponding to the interface; and another browser kernel does not provide the interface function, according to the above
- the kernel provides an interface function for realizing the function corresponding to the interface, and a target interface function is preset for another browser kernel, and the function required to be implemented by the target interface function and the interface function provided by the kernel to implement the function corresponding to the interface need to be implemented.
- the functions are the same and the calling specifications are the same.
- the target interface function may be a combination of existing interface functions (for example, as shown in code 4), or may be a rewritten interface function (for example, as shown in code 5), specifically, according to the actual The case is selected, and the embodiment of the present invention is not limited.
- FakeInterfaceB can realize the functions that the interface function InterfaceA needs to implement by combining the existing interface functions (TridentInterfaceB1, TridentInterfaceB2 and TridentInterfaceB3) in the Trident kernel. By combining these interfaces, you can implement and link The kernel provides the same functionality as interface A.
- the target interface function FakeInterfaceB can be as shown in code 4.
- the target browser kernel corresponding to the client script is the blink kernel, and the currently running browser kernel is the Trident kernel, then the preset interface is run.
- the function FakeInterfaceB is the function FakeInterfaceB.
- an interface function TridentInterfaceC that implements this function is set in advance for the Trident kernel.
- the preset target interface function FakeInterfaceC can be as shown in code 5.
- the target browser kernel corresponding to the client script is the blink kernel, and the currently running browser kernel is the Trident kernel, then the preset target is run.
- the interface function FakeInterfaceC is the interface function FakeInterfaceC.
- the parameter carried in the interface call instruction is used as an input parameter of the target interface function, and the target interface function is called.
- the parameters carried in the interface call instruction are substituted into the target interface function, and the target interface function is executed or executed.
- the compatibility of the browser is improved by pre-normalizing the interfaces provided by different browser kernels.
- an interface call instruction is received, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script; when the browser kernel currently running in the browser is not a target browser kernel corresponding to the client script, and the first interface function corresponding to the interface identifier provided by the currently running browser kernel and the interface identifier corresponding to the interface identifier provided by the target browser kernel
- the second interface function is different, obtaining a target interface function of the currently running browser kernel corresponding to the preset interface identifier; using the parameter as an input parameter of the target interface function, calling the target interface function.
- the interface functions provided by some interfaces are different, and the interface functions that can be replaced are preset, so that whether the currently running browser kernel is a client or not
- the target browser kernel corresponding to the script the browser can normally execute the client script to call the request of the partial difference interface, thereby avoiding the running error of the client script when calling the part of the difference interface, and improving the compatibility of the browser.
- FIG. 2 is another schematic flowchart of an interface calling method according to an embodiment of the present invention.
- the method may include the following steps.
- S201 Upon receiving the trigger instruction for loading the extension, start a new process to load the main program, and the target browser kernel is loaded in the new process.
- extensions include a main program loaded in a browser and/or a script loaded in a web page.
- the extension is associated with the browser kernel. For example, extensions developed based on the blink kernel can only run normally in the blink kernel. Extensions developed based on the Firefox kernel can only run normally in the Firefox kernel.
- the plugin can only run normally on web pages opened based on the blink kernel, but in web pages that are not opened based on the blink kernel (such as the Trident kernel). A runtime error may occur during runtime.
- the browser includes at least the main process during the running process.
- the rendering process may also include a rendering process. If the rendering process is included, the rendering of the webpage content is performed in the rendering process. If the rendering process is not included, the rendering of the webpage content is performed. Work is done in the main process.
- the extension plug-in includes a main program loaded in the browser, when receiving the trigger instruction for loading the extension, a new process is started to load the main program, and the new process is loaded with the Target browser kernel.
- the browser is a dual-core browser, which is the Trident kernel and the blink kernel respectively.
- the target browser kernel corresponding to the extension is the Trident kernel, and the extension can be automatically loaded when the browser is started, or the browser can be successfully started. Manually load the extension.
- the browser receives the trigger instruction to load the extension, it automatically creates a new page, launches a rendering process loaded with the Trident kernel for the page, and runs the main program corresponding to the extension in the rendering process.
- the main program can run normally in the browser.
- the extension includes a script loaded in a webpage
- the script corresponding to the extension needs to be inserted into the opened webpage, thereby loading the extension by loading the webpage.
- the corresponding script program when a trigger event of opening a webpage is detected (for example, the triggering time may be a triggering event of starting a browser or creating a new tab, etc.), the client script corresponding to the extension that needs to be loaded in the browser is used. Insert the webpage to be opened.
- the extension is a plugin with translation capabilities
- the plugin includes the main program loaded in the browser and the script loaded in the web page.
- a new process is started to load the main program, wherein the target browser core corresponding to the extension is loaded in the new process.
- the client script corresponding to the extension is inserted into the webpage to be opened. Therefore, the text message that needs to be translated on the webpage is obtained by the client script loaded in the webpage, and the obtained text information is sent as an interface parameter to be called to the main program loaded in the browser, and the main program is transmitted through the network.
- the server obtains the translation information of the text information, and finally displays the obtained translation information to the webpage.
- S203 Receive an interface call instruction, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script.
- the interface call instruction In the process of loading the webpage, the interface call instruction is received, and the interface call instruction carries an interface identifier and a parameter corresponding to the interface that the client script needs to invoke.
- the interface identifier may be an interface name or an identifier that is unique to the interface name. Specifically, the embodiment of the present invention does not limit the present invention.
- the browser kernel currently running in the browser is not the target browser kernel corresponding to the client script, and the first interface function corresponding to the interface identifier provided by the currently running browser kernel and the When there is a difference between the second interface function corresponding to the interface identifier provided by the target browser kernel, the interface identifier corresponding to the interface function of the currently running browser kernel is queried from the preset information base according to the interface identifier.
- the interface functions provided by the interface are different, and an interface function for replacing the interfaces with different differences is preset, and the preset interface functions and pairs are set.
- the interface identifier should be saved in the preset information base. Therefore, according to the interface identifier carried by the interface call instruction, it can be known whether there is a difference in the interface function provided by the interface to be called in different browser kernels. When receiving the interface call instruction, obtain the type of the browser kernel currently running in the browser.
- the browser kernel currently running in the browser is referred to as the first browser kernel; according to the target corresponding to the client script
- the type of the browser kernel identifying whether the type of the first browser kernel is consistent with the type of the target browser kernel; if not, the interface identifier carried by the interface call instruction identifies that the interface to be called is provided in the first browser kernel Whether the interface function is different from the interface function provided in the target browser kernel; if yes, querying, according to the interface identifier, the interface identifier corresponding to the interface function of the currently running browser kernel from the preset information base.
- the parameter carried in the interface call instruction is used as an input parameter of the target interface function, and the target interface function is called.
- the parameters carried in the interface call instruction are substituted into the target interface function, and the target interface function is executed or executed.
- the compatibility of the browser is improved by pre-normalizing the interfaces provided by different browser kernels.
- an interface call instruction is received, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script; when the browser kernel currently running in the browser is not a target browser kernel corresponding to the client script, and the first interface function corresponding to the interface identifier provided by the currently running browser kernel and the interface identifier corresponding to the interface identifier provided by the target browser kernel
- the second interface function is different, obtaining a target interface function of the currently running browser kernel corresponding to the preset interface identifier; using the parameter as an input parameter of the target interface function, calling the target interface function.
- the interface functions provided by some interfaces are different, and the interface functions that can be replaced are preset, so that whether the currently running browser kernel is a client or not
- the target browser kernel corresponding to the script the browser can normally execute the client script to call the request of the partial difference interface, thereby avoiding the running error of the client script when calling the part of the difference interface, and improving the compatibility of the browser.
- the device embodiment of the present invention is the same as the method embodiment of the present invention, and is used to perform the method described in the method embodiment of the present invention.
- the device embodiment of the present invention only shows a part related to the device embodiment of the present invention. If the specific technical details are not disclosed, please refer to the description of the method embodiment of the present invention. One by one.
- FIG. 3 is a schematic structural diagram of an interface invoking device according to an embodiment of the present invention.
- the device may be applied to a browser, including: a receiving module 101, a determining module 102, and a call. Module 103.
- the receiving module 101 is configured to receive an interface call instruction, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script.
- the determining module 102 is configured to: when the browser kernel currently running in the browser is not the target browser kernel corresponding to the client script, and the first interface corresponding to the interface identifier provided by the currently running browser kernel And obtaining a target interface function of the currently running browser kernel corresponding to the preset interface identifier, where the function and the second interface function corresponding to the interface identifier provided by the target browser kernel are different,
- the target interface function is a third interface function corresponding to the currently running browser kernel according to the second interface function provided by the target browser kernel.
- the calling module 103 is configured to invoke the parameter as the input parameter of the target interface function, and invoke the target interface function.
- an interface call instruction is received, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script; when the browser kernel currently running in the browser is not Determining, according to the target browser kernel corresponding to the client script, the interface function corresponding to the interface identifier provided by the currently running browser kernel and the target browser kernel respectively
- the target interface function of the currently running browser kernel, the target interface function is a preset interface function; the parameter is used as an input parameter of the target interface function, and the target interface function is called.
- the interface functions provided by some interfaces are different, and the interface functions that can be replaced are preset, so that whether the currently running browser kernel is a client or not
- the target browser kernel corresponding to the script the browser can normally execute the client script to call the request of the partial difference interface, thereby avoiding the running error of the client script when calling the part of the difference interface, and improving the compatibility of the browser.
- FIG. 4 is another schematic structural diagram of an interface invoking device according to an embodiment of the present invention.
- the device may include: a receiving module 201, a determining module 202, a calling module 203, and an insertion.
- the receiving module 201 is configured to receive an interface call instruction, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that needs to be invoked by the client script.
- the determining module 202 is configured to: when the browser kernel currently running in the browser is not the target browser kernel corresponding to the client script, and the first interface corresponding to the interface identifier provided by the currently running browser kernel Function and Obtaining, by the target browser kernel, a second interface function corresponding to the interface identifier, acquiring a target interface function of the currently running browser kernel corresponding to the preset interface identifier, the target interface function Presetting a third interface function corresponding to the currently running browser kernel according to the second interface function provided by the target browser kernel.
- the calling module 203 is configured to invoke the parameter as an input parameter of the target interface function, and invoke the target interface function.
- the client script is a script program included in the extension in the browser, and the module 204 is configured to: when the trigger event of opening the webpage is detected, the browser needs to be loaded.
- the client script corresponding to the extension plugin is inserted into the webpage to be opened.
- the extension further includes a main program loaded in the browser, and the startup module 205 is configured to start a new process to load the main program when receiving a trigger instruction for loading the extension.
- the target browser kernel is loaded in the new process.
- the returning module 206 is configured to return a result of the calling of the target interface function.
- the determining module 202 is specifically configured to:
- the interface identifier is queried from the preset information base according to the interface function of the currently running browser kernel;
- an interface call instruction is received, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script; when the browser kernel currently running in the browser is not a target browser kernel corresponding to the client script, and the first interface function corresponding to the interface identifier provided by the currently running browser kernel and the interface identifier corresponding to the interface identifier provided by the target browser kernel
- the second interface function is different, obtaining a target interface function of the currently running browser kernel corresponding to the preset interface identifier; using the parameter as an input parameter of the target interface function, calling the target interface function.
- the interface functions provided by some interfaces are different, and the interface functions that can be replaced are preset, so that whether the currently running browser kernel is a client or not
- the target browser kernel corresponding to the script the browser can normally execute the client script to call the request of the partial difference interface, thereby avoiding the running error of the client script when calling the part of the difference interface, and improving the compatibility of the browser.
- FIG. 5 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
- Terminal 10 includes an interface calling device as described above.
- the terminal may include: a smart phone, a computer, a tablet computer, a notebook computer, a palmtop computer, and a terminal device such as a mobile Internet device (MID) or a PAD.
- MID mobile Internet device
- PAD PAD
- the embodiment of the present invention is not limited.
- the terminal 10 includes any interface calling device as described above, and the terminal receives an interface calling instruction, where the interface calling instruction carries an interface identifier and a parameter corresponding to an interface that needs to be invoked by the client script;
- the browser kernel currently running in the browser is not the target browser kernel corresponding to the client script, and the first interface function corresponding to the interface identifier and the target browser kernel provided by the currently running browser kernel are provided.
- the input parameter, the target interface function is called.
- the interface functions provided by some interfaces are different, and the interface functions that can be replaced are preset, so that whether the currently running browser kernel is a client or not
- the target browser kernel corresponding to the script the browser can normally execute the client script to call the request of the partial difference interface, thereby avoiding the running error of the client script when calling the part of the difference interface, and improving the compatibility of the browser.
- FIG. 6 is another schematic structural diagram of an interface calling apparatus according to an embodiment of the present invention, for performing an interface calling method disclosed in an embodiment of the present invention, where the apparatus may include: at least one processor 301, for example, The CPU, at least one network interface 304 or other user interface 303, memory 305, at least one communication bus 302. Communication bus 302 is used to implement connection communication between these components.
- the user interface 303 can optionally include a USB interface and other standard interfaces and wired interfaces.
- Network interface 304 may optionally include a Wi-Fi interface as well as other wireless interfaces.
- the memory 305 may include a high speed RAM memory and may also include a non-volatile memory such as at least one disk memory.
- the memory 305 can optionally include at least one storage device located remotely from the aforementioned processor 301. As shown in FIG. 6, an operating system 3051 and an application 3052 may be included in the memory 305 as a computer storage medium.
- the memory 305 stores the following elements, executable modules or data structures, or a subset thereof, or their extension set:
- An operating system 3051 including various system programs for implementing various basic services and processing hardware-based tasks;
- the application 3052 includes various setting programs of a data block parameter setting program of the target network data, a partitioning program of the target data block, a comparison program of the target data block and the data block in the database, and a deletion program of the target data block, and the like. To achieve a variety of application services.
- the processor 301 is configured to invoke a program stored in the memory 305 to perform the following operations:
- the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script
- the browser kernel currently running in the browser is not the target browser kernel corresponding to the client script, and the first interface function corresponding to the interface identifier provided by the currently running browser kernel and the target browsing Obtaining a target interface function of the currently running browser kernel corresponding to the preset interface identifier, where the second interface function corresponding to the interface identifier is different, and the target interface function is The second interface function provided by the target browser kernel performs a preset third interface function corresponding to the currently running browser kernel;
- the target interface function is invoked by using the parameter as an input parameter of the target interface function.
- the client script is a script program included in an extension in the browser, and the processor 301 executes the receiving interface call instruction, where the interface call instruction carries a load client script.
- the following operations are also performed:
- the client script corresponding to the extension that needs to be loaded in the browser is inserted into the webpage to be opened.
- the extension further includes a main program loaded in a browser, and the processor 301 executes the receiving interface calling instruction, where the interface calling instruction carries an interface corresponding to the calling client script to be called.
- the following operations are also performed:
- a new process is started to load the main program, and the target browser kernel is loaded in the new process.
- the processor 301 performs: when the browser kernel currently running in the browser is not the target browser kernel corresponding to the client script, and the currently running browser kernel provides the same When the first interface function corresponding to the interface identifier is different from the second interface function corresponding to the interface identifier provided by the target browser kernel, the currently running browser corresponding to the preset interface identifier is obtained.
- the operation of the kernel's target interface function including the following:
- the interface identifier is queried from the preset information base according to the interface function of the currently running browser kernel;
- the processor 301 performs the input parameter that uses the parameter as the target interface function. After the operation of the target interface function is invoked, the method further includes:
- an interface call instruction is received, where the interface call instruction carries an interface identifier and a parameter corresponding to an interface that is required to be loaded by the client script; when the browser kernel currently running in the browser is not a target browser kernel corresponding to the client script, and the first interface function corresponding to the interface identifier provided by the currently running browser kernel and the first interface corresponding to the interface identifier provided by the target browser kernel When there is a difference between the two interface functions, obtaining a target interface function of the currently running browser kernel corresponding to the preset interface identifier; using the parameter as an input parameter of the target interface function, calling the target interface function .
- the interface functions provided by some interfaces are different, and the interface functions that can be replaced are preset, so that whether the currently running browser kernel is a client or not
- the target browser kernel corresponding to the script the browser can normally execute the client script to call the request of the partial difference interface, thereby avoiding the running error of the client script when calling the part of the difference interface, and improving the compatibility of the browser.
- modules or units in all the embodiments of the present invention may be implemented by a general-purpose integrated circuit, such as a CPU (Central Processing Unit) or an ASIC (Application Specific Integrated Circuit).
- a CPU Central Processing Unit
- ASIC Application Specific Integrated Circuit
- a system, apparatus, or device such as a computer-based system, a system including a processor, or other system that can fetch instructions and execute instructions from an instruction execution system, apparatus, or device), or in conjunction with such instructions to execute a system, apparatus, or device.
- a "computer-readable medium" can be any apparatus that can contain, store, communicate, propagate, or transport a program for use in an instruction execution system, apparatus, or device, or in conjunction with the instruction execution system, apparatus, or device.
- computer readable media include the following: electrical connections (electronic devices) having one or more wires, portable computer disk cartridges (magnetic devices), random access memory (RAM), Read only memory (ROM), erasable editable read only memory (EPROM or flash memory), fiber optic devices, and portable compact disk read only memory (CDROM).
- the computer readable medium may even be a paper or other suitable medium on which the program can be printed, as it may be optically scanned, for example by paper or other medium, followed by editing, interpretation or, if appropriate, other suitable The method is processed to obtain the program electronically and then stored in computer memory.
- each functional unit in each embodiment of the present invention may be integrated into one processing module, or each unit may exist physically separately, or two or more units may be integrated into one module.
- the above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
- the integrated modules, if implemented in the form of software functional modules and sold or used as stand-alone products, may also be stored in a computer readable storage medium.
- the above mentioned storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephone Function (AREA)
- Information Transfer Between Computers (AREA)
- Stored Programmes (AREA)
Abstract
L'invention porte sur un procédé d'appel d'interface, un dispositif d'appel d'interface et un terminal, qui peuvent améliorer la compatibilité d'un navigateur. Le procédé comprend : la réception d'une instruction d'appel d'interface, l'instruction d'appel d'interface transportant un identificateur d'interface et des paramètres, correspondant à une interface qui a besoin d'être appelée pour charger un script de client (S101) ; lorsqu'un noyau de navigateur, qui est actuellement actionné dans un navigateur, n'est pas un noyau de navigateur cible correspondant au script de client, et qu'une première fonction d'interface, qui est fournie par le noyau de navigateur actuellement actionné et correspond à l'identificateur d'interface, est différente d'une seconde fonction d'interface, qui est fournie par le noyau de navigateur cible et correspond à l'identificateur d'interface, l'acquisition d'une fonction d'interface cible préréglée, qui correspond à l'identificateur d'interface, du noyau de navigateur actuellement actionné (S102) ; et la prise des paramètres en tant que paramètres d'entrée de la fonction d'interface cible, et l'appel de la fonction d'interface cible (S103).
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510229507.9A CN104881318B (zh) | 2015-05-07 | 2015-05-07 | 一种接口调用方法、装置及终端 |
CN201510229507.9 | 2015-05-07 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2016177341A1 true WO2016177341A1 (fr) | 2016-11-10 |
Family
ID=53948824
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/081184 WO2016177341A1 (fr) | 2015-05-07 | 2016-05-05 | Procédé et dispositif d'appel d'interface, et terminal |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN104881318B (fr) |
WO (1) | WO2016177341A1 (fr) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110333914A (zh) * | 2019-04-12 | 2019-10-15 | 上海连尚网络科技有限公司 | 一种用于执行目标操作的方法与设备 |
CN113961366A (zh) * | 2020-07-20 | 2022-01-21 | 华为技术有限公司 | 操作系统的内核函数调用方法及计算机设备 |
CN115086393A (zh) * | 2022-06-13 | 2022-09-20 | 卫宁健康科技集团股份有限公司 | 一种接口调用方法、装置、设备及存储介质 |
Families Citing this family (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104881318B (zh) * | 2015-05-07 | 2019-06-25 | 珠海豹趣科技有限公司 | 一种接口调用方法、装置及终端 |
CN107632848B (zh) * | 2016-07-13 | 2020-02-07 | 腾讯科技(深圳)有限公司 | 数据处理方法和装置 |
CN106708967B (zh) * | 2016-11-30 | 2020-06-02 | 北京小米移动软件有限公司 | 页面显示方法及装置 |
CN107301137A (zh) * | 2017-07-04 | 2017-10-27 | 福建中金在线信息科技有限公司 | Rset接口实现方法和装置及电子设备和计算机可读存储介质 |
CN107977243A (zh) * | 2017-11-27 | 2018-05-01 | 海尔优家智能科技(北京)有限公司 | 一种第三方接口调用方法及装置 |
CN109032612B (zh) * | 2018-07-02 | 2022-01-28 | 平安科技(深圳)有限公司 | 混合型应用的接口调用方法、装置及计算机可读存储介质 |
CN109976756B (zh) * | 2019-03-11 | 2022-11-11 | 宸瑞普惠(广州)科技有限公司 | Ui显示效果一致性的处理方法与系统 |
CN112181406A (zh) * | 2019-06-14 | 2021-01-05 | 北京搜狗科技发展有限公司 | 一种渲染引擎的共享方法和装置 |
CN110442400B (zh) * | 2019-08-15 | 2023-04-18 | 网易(杭州)网络有限公司 | 浏览器控制方法及装置 |
CN110688180B (zh) * | 2019-09-03 | 2021-05-11 | 华云数据控股集团有限公司 | 前端系统、前端数据流控制方法、电子设备及存储介质 |
CN112214712A (zh) * | 2020-10-28 | 2021-01-12 | 新华三大数据技术有限公司 | 一种浏览器的自动切换方法、装置、存储介质及电子设备 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103019817A (zh) * | 2012-11-30 | 2013-04-03 | 北京奇虎科技有限公司 | 一种用于页面交互的方法与装置 |
CN103176834A (zh) * | 2011-12-26 | 2013-06-26 | 腾讯科技(深圳)有限公司 | 一种调用扩展接口的方法及装置 |
CN104281455A (zh) * | 2014-10-11 | 2015-01-14 | 北京金山安全软件有限公司 | 一种接口调用方法、装置及终端 |
WO2015021860A1 (fr) * | 2013-08-15 | 2015-02-19 | Tencent Technology (Shenzhen) Company Limited | Procédé et appareil de chargement d'un moteur de rendu |
CN104881318A (zh) * | 2015-05-07 | 2015-09-02 | 北京金山安全软件有限公司 | 一种接口调用方法、装置及终端 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020055981A1 (en) * | 2000-08-31 | 2002-05-09 | Frederic Spaey | System and method for remotely browsing structured data |
US7748609B2 (en) * | 2007-08-31 | 2010-07-06 | Gemalto Inc. | System and method for browser based access to smart cards |
CN103226474B (zh) * | 2013-05-10 | 2016-09-28 | 北京奇虎科技有限公司 | 网页脚本与浏览器程序之间的交互方法、装置及系统 |
-
2015
- 2015-05-07 CN CN201510229507.9A patent/CN104881318B/zh active Active
-
2016
- 2016-05-05 WO PCT/CN2016/081184 patent/WO2016177341A1/fr active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103176834A (zh) * | 2011-12-26 | 2013-06-26 | 腾讯科技(深圳)有限公司 | 一种调用扩展接口的方法及装置 |
CN103019817A (zh) * | 2012-11-30 | 2013-04-03 | 北京奇虎科技有限公司 | 一种用于页面交互的方法与装置 |
WO2015021860A1 (fr) * | 2013-08-15 | 2015-02-19 | Tencent Technology (Shenzhen) Company Limited | Procédé et appareil de chargement d'un moteur de rendu |
CN104281455A (zh) * | 2014-10-11 | 2015-01-14 | 北京金山安全软件有限公司 | 一种接口调用方法、装置及终端 |
CN104881318A (zh) * | 2015-05-07 | 2015-09-02 | 北京金山安全软件有限公司 | 一种接口调用方法、装置及终端 |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110333914A (zh) * | 2019-04-12 | 2019-10-15 | 上海连尚网络科技有限公司 | 一种用于执行目标操作的方法与设备 |
CN110333914B (zh) * | 2019-04-12 | 2023-09-15 | 上海连尚网络科技有限公司 | 一种用于执行目标操作的方法与设备 |
CN113961366A (zh) * | 2020-07-20 | 2022-01-21 | 华为技术有限公司 | 操作系统的内核函数调用方法及计算机设备 |
CN115086393A (zh) * | 2022-06-13 | 2022-09-20 | 卫宁健康科技集团股份有限公司 | 一种接口调用方法、装置、设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN104881318A (zh) | 2015-09-02 |
CN104881318B (zh) | 2019-06-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2016177341A1 (fr) | Procédé et dispositif d'appel d'interface, et terminal | |
EP3876116B1 (fr) | Procédé et appareil pour exécuter un mini-programme, dispositif électronique et support de stockage | |
US10325009B2 (en) | Method and apparatus for using custom component parsing engine to parse tag of custom component | |
WO2016192556A1 (fr) | Procédé, dispositif et terminal d'invocation d'interface | |
CN107861713B (zh) | 数据调用方法、装置及计算机可读存储介质 | |
US10176270B2 (en) | Performance of template based javascript widgets | |
US20100218106A1 (en) | Automatically Selecting Internet Browser and Providing Web Page Service | |
TW201732647A (zh) | 一種網頁腳本載入方法和裝置 | |
US8539506B2 (en) | Dynamic injection of code into running process | |
US9727354B2 (en) | System and methods for loading an application and its modules in a client device | |
CN108415804B (zh) | 获取信息的方法、终端设备及计算机可读存储介质 | |
US20140108914A1 (en) | Webpages with onboard hardware functions | |
US11553035B2 (en) | Cross-platform module for loading across a plurality of device types | |
TW201839593A (zh) | 交互處理方法及裝置 | |
WO2020010725A1 (fr) | Procédé et appareil permettant de rafraîchir de manière automatique et synchronisée un navigateur, et un dispositif informatique | |
CN108170430B (zh) | 一种界面展示的方法及系统 | |
CN111813385A (zh) | 一种基于Web应用的页面插件化方法、装置及设备 | |
CN110955409A (zh) | 在云平台上创建资源的方法和装置 | |
US20240179224A1 (en) | Systems and methods for rendering interactive web pages | |
US20130081010A1 (en) | Template and server content download using protocol handlers | |
US11687326B2 (en) | Method and apparatus for data interaction | |
CN110262841B (zh) | 一种对字节码进行增强的方法和装置 | |
CN107092601B (zh) | 资源文件构建方法、资源文件应用方法及装置 | |
CN107704279B (zh) | 一种数据加载方法以及装置 | |
CN115525305A (zh) | 数据处理、应用启动方法、装置、计算机设备和存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16789335 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 21/02/2018) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16789335 Country of ref document: EP Kind code of ref document: A1 |