Web application operation methods, devices, electronic devices and readable storage media

By using a layered adaptation model based on interface semantic transfer, a target interface is generated to replace the interface to be replaced, which solves the browser incompatibility problem and enables low-cost, highly compatible web application operation.

CN122308958APending Publication Date: 2026-06-30龙芯中科(合肥)技术有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
龙芯中科(合肥)技术有限公司
Filing Date
2026-03-31
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, web applications are incompatible with browsers, causing them to fail to run or to malfunction, and the implementation costs of cloud services and virtualization technologies are relatively high.

Method used

By using a layered adaptation model for interface semantic migration, the operational behavior of the interface to be replaced is obtained, interface behavior mapping rules are generated, and a target interface is built in the first type of kernel to replace the interface to be replaced, so that it can be called in the first type of kernel and the execution result is consistent with the second type of kernel, thereby achieving the compatible operation of web applications.

Benefits of technology

It achieves low-cost, highly compatible, and highly accurate web application compatibility without switching browser kernels or relying on virtualization or cloud environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122308958A_ABST
    Figure CN122308958A_ABST
Patent Text Reader

Abstract

This invention provides a method, apparatus, electronic device, and readable storage medium for running a web application. The method includes: obtaining a replacement interface called in a web application to be run; the replacement interface is an application programming interface (API) with incompatible behavior between a first type of kernel and a second type of kernel; obtaining the operational behavior of the replacement interface in different kernels, and generating interface behavior mapping rules based on the behavior differences; generating a target interface based on the interface behavior mapping rules, the target interface being callable in the first type of kernel and having an execution result consistent with the operational behavior of the replacement interface in the second type of kernel; replacing the replacement interface with the target interface in the web application to be run, and running the replaced web application in a browser with the first type of kernel. It can be run directly on the current browser without incurring high costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and readable storage medium for running web applications. Background Technology

[0002] With the development of computer technology, web applications are being used more and more frequently in various fields. However, web applications require a browser to run, and some web applications are incompatible with browsers, resulting in them failing to run or encountering errors.

[0003] To address these issues, related technologies often involve running web applications in the cloud or virtual machines that contain different browsers. However, the high cost of implementing cloud services and virtualization technologies significantly increases the cost of ensuring application compatibility. Summary of the Invention

[0004] The purpose of this invention is to provide a method, apparatus, electronic device, and readable storage medium for running web applications, thereby solving the problem of high costs associated with running applications on multiple devices simultaneously. The specific technical solution is as follows: In a first aspect of this invention, a method for running a web application is provided. The method is applied to a browser employing a first-type kernel. The method includes: obtaining a replacement interface called in a web application to be run; the replacement interface is an application programming interface (API) with incompatible behavior between the first-type kernel and a second-type kernel; obtaining the operational behavior of the replacement interface in different kernels and generating interface behavior mapping rules based on the behavioral differences; constructing or determining a target interface based on the interface behavior mapping rules, such that the target interface can be called in the first-type kernel; adjusting the execution behavior of the target interface based on the interface behavior mapping rules, so that the execution result of the target interface in the first-type kernel is consistent with the operational behavior of the replacement interface in the second-type kernel; replacing the replacement interface with the target interface in the web application to be run, and running the replaced web application in a browser with the first-type kernel.

[0005] In a second aspect of the invention, an application running device is also provided. The device is applied to a browser employing a first type of kernel. The device includes: a first acquisition module, configured to acquire a replacement interface called in a web application to be run; the replacement interface is an application programming interface (API) with incompatible behavior between the first type of kernel and a second type of kernel; a first creation module, configured to acquire the operational behavior of the replacement interface in different kernels and generate interface behavior mapping rules based on the behavioral differences; a first execution module, configured to construct or determine a target interface based on the interface behavior mapping rules, so that the target interface can be called in the first type of kernel; a first adjustment module, configured to adjust the execution behavior of the target interface based on the interface behavior mapping rules, so that the execution result of the target interface in the first type of kernel is consistent with the operational behavior of the replacement interface in the second type of kernel; and a replacement module, configured to replace the replacement interface with the target interface in the web application to be run, and run the replaced web application in a browser with the first type of kernel.

[0006] In a third aspect of the present invention, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. Memory, used to store computer programs; When a processor executes a program stored in memory, it implements the method described in the first aspect above.

[0007] In a fourth aspect of the invention, a computer-readable storage medium is also provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the method described in the first aspect.

[0008] In a fifth aspect of the invention, a computer program product comprising instructions is also provided, which, when run on a computer, causes the computer to perform the method described in the first aspect above.

[0009] The application running method provided in this invention is applied to browsers using a first-type kernel. This method offers a layered adaptation model for interface semantic migration to achieve interface compatibility. The interface behavior mapping rules are integrated throughout the entire process of interface structure adaptation and interface behavior adaptation, providing unified guidance for interface structure construction and execution behavior adjustment. Based on the interface behavior mapping rules, the migration of interface execution semantics between different browser kernels is achieved, thereby enabling compatible operation of web applications without switching browser kernels or relying on virtualization or cloud environments. This method has the advantages of low implementation cost, strong compatibility, and high adaptation accuracy. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.

[0011] Figure 1 This is a flowchart illustrating the steps of an application operation method in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of an application running device according to an embodiment of the present invention; Figure 3 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0012] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0013] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, the first object can be one or more. Furthermore, the term "and / or" in the specification and claims is used to describe the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. In embodiments of this invention, the term "multiple" refers to two or more, and other quantifiers are similar.

[0014] This embodiment provides a method for running web applications. The method is applied to browsers using a first-type kernel and is implemented based on a layered adaptation model of interface semantic migration. By adapting the interface structure and the interface behavior, the interface semantics between different browser kernels are aligned, thereby enabling the compatible operation of web applications without switching browser kernels or relying on virtualization or cloud environments.

[0015] Figure 1 This is a flowchart illustrating the steps of an application running method in an embodiment of the present invention. This method is applied to a browser using a first-type kernel, such as... Figure 1 As shown, the method includes: Step 101: Obtain the interfaces to be replaced called in the web application to be run; wherein, the interfaces to be replaced are application programming interfaces that have incompatible behavior between the first type of kernel and the second type of kernel, including: interfaces that are not recognized or not supported in the first type of kernel; and interfaces that are recognized in both the first type of kernel and the second type of kernel but whose operation behavior is inconsistent.

[0016] Specifically, the interface to be replaced can be obtained in the following way: (1) Perform static analysis on the program code of the web application, parse the interface calls in the JavaScript code, and compare them with the set of interfaces supported by the first type of kernel to determine the interfaces that are not supported or have inconsistent behavior. (2) During the operation of the web application, the interface to be replaced is dynamically identified by capturing interface call exceptions or execution result exceptions.

[0017] For example, in one embodiment, the interface to be replaced may be the interface window.createPopup, which is not supported in the first type of kernel; in another embodiment, the interface to be replaced may be the interface window.close, which has inconsistent behavior in different kernels.

[0018] Step 102: Obtain the operation behavior of the interface to be replaced in different kernels, and generate interface behavior mapping rules based on the behavior differences.

[0019] Specifically, the interface to be replaced is executed in the first type of kernel and the second type of kernel respectively, and behavioral information during the interface execution process is collected. The behavioral information includes, but is not limited to: input parameters of the interface call, interface return results, changes in the document object model, changes in page or interface state, and events triggered during interface execution.

[0020] Furthermore, the behavioral information can be structured to obtain an interface behavior model, which includes input parameters, output results, DOM changes, state changes, and event behaviors.

[0021] For example, in one embodiment, the behavior model for the window.createPopup interface may include returning a Popup object, creating a popup node, updating the isOpen state, and triggering a close event when the window is out of focus; in another embodiment, the behavior model for the window.close interface may include whether to close the window, whether to pop up a confirmation dialog, and the behavior when executed in an iframe.

[0022] After obtaining the operational behavior of the interface to be replaced in different kernels, the operational behavior is compared, and interface behavior mapping rules are generated based on the behavioral differences.

[0023] Specifically, a difference analysis can be performed on the operational behaviors in the first type of kernel and the operational behaviors in the second type of kernel to determine the differences between them, and a mapping rule can be constructed based on the differences. The interface behavior mapping rule is used to describe the conversion relationship between the interface execution behavior in the first type of kernel and the interface semantics of the second type of kernel. The mapping rule includes: behavior triggering conditions, behavior replacement logic, state update rules, and event handling rules.

[0024] For example, in one embodiment, the mapping rules for the window.createPopup interface may include displaying the pop-up window by adding DOM nodes, closing the window by deleting DOM nodes, and triggering closing logic when the page loses focus; in another embodiment, the mapping rules for the window.close interface may include adding confirmation prompt logic when the main window is closed, allowing the closure of child windows in an iframe environment, and restricting the closing operation under specific window types.

[0025] Preferably, the interface behavior mapping rule is used not only to guide the adaptation of interface execution behavior, but also to determine the interface structure of the target interface, including the definition of the returned object, attributes, and methods. This interface behavior mapping rule is established separately at the interface level, method level, or parameter level, and stored in the form of configuration files, interface description files, or mapping tables.

[0026] Step 103: Generate a target interface based on the interface behavior mapping rules. The target interface can be called in the first type of kernel, and the execution result in the first type of kernel is consistent with the operation behavior of the interface to be replaced in the second type of kernel.

[0027] In this embodiment, generating the target interface includes: step 1031 constructing or determining the target interface based on the interface behavior mapping rules, so that the target interface can be called in the first type of kernel.

[0028] Specifically, after generating interface behavior mapping rules, the interface is structurally adapted based on these rules to construct or determine the target interface. This interface structural adaptation includes: When there is no interface in the first type of kernel that can carry the interface semantics, a target interface is added to the interface definition file of the first type of kernel browser, and the corresponding return object, attributes and methods are constructed based on the interface behavior mapping rules. When there is an interface in the first type of kernel that can carry the interface semantics, a target interface is selected from the existing interfaces in the first type of kernel, and the target interface is associated with the interface behavior mapping rule.

[0029] For example, in one embodiment, for the window.createPopup interface, a Popup interface can be added to the interface definition file, and the document property, isOpen property, and show and hide methods can be defined; in another embodiment, for the window.close interface, the window.close interface that already exists in the first type of kernel can be directly selected as the target interface.

[0030] And step 1032, adjusting the execution behavior of the target interface based on the interface behavior mapping rule, so that the execution result of the target interface in the first type of kernel is consistent with the operation behavior of the interface to be replaced in the second type of kernel.

[0031] In this embodiment, the adjustment of execution behavior includes configuring the initial behavior of the newly created interface or modifying the behavior of an existing interface. Specifically, ensuring that the execution result of the target interface in the first type of kernel is consistent with the operation behavior of the interface to be replaced in the second type of kernel involves calling an interface supported by the first type of kernel to implement the target interface function, and implementing a behavior response consistent with the second type of kernel based on an event mechanism. For example, in one embodiment, for the `window.createPopup` interface, the display and closing of the pop-up window can be achieved by calling a DOM manipulation interface supported by the first type of kernel; in another embodiment, for the `window.close` interface, its execution behavior can be made consistent with the second type of kernel by adding window state judgment and confirmation prompt logic.

[0032] Step 104: Replace the interface to be replaced with the target interface in the web application to be run, and run the replaced web application in the browser of the first type of kernel.

[0033] The replacement action can be a static replacement of the web application code, or a dynamic replacement at runtime through interface binding.

[0034] By making the above replacements, web applications can achieve the same execution semantics as those in the second type of kernel when calling the target interface in the first type of kernel.

[0035] For steps 101-104 above, this embodiment of the invention can be applied to any browser, including Microsoft Browser (Internet Explorer, IE), Google Chrome (Chromium), and of course, 360 Browser, etc. It can be configured according to the actual application's operational needs; this embodiment of the invention does not impose any limitations on this. The aforementioned kernel refers to the browser's core engine, which is used to parse Hypertext Markup Language (HTML), construct the Document Object Model (DOM) tree, calculate the layout, and finally render (paint) the web page content. Simultaneously, it executes dynamic programming language (JavaScript, JS) code to implement dynamic interactions. Therefore, the kernel is particularly important for the operation of web applications.

[0036] Specifically, the first and second types of kernels mentioned above refer to different browser kernels. For example, the first type of kernel could be Google's open-source Blink engine, and the browser could be Chromium, 360 Browser, etc. Correspondingly, the second type of kernel could be the IE kernel. Of course, the first type of kernel could also be the IE kernel (Trident engine), and the second type of kernel could be the Blink kernel. The kernel can be customized based on the actual situation of the web application to be run and the browser; this embodiment of the invention does not impose any limitations on this.

[0037] In this embodiment of the invention, the interface refers to an Application Programming Interface (API), which can be a JS-API used to interact with JS code. Correspondingly, the interface to be replaced refers to a JS-API that is incompatible with the browser. Specifically, incompatible interfaces can include JS-APIs that the browser cannot recognize, and can also include JS-APIs that the browser can recognize but whose corresponding operational behaviors are inconsistent. Specifically, this embodiment of the invention can first obtain the JS-APIs used in the web application to be run, and compare them with the JS-APIs supported by the first type of kernel, identifying the inconsistent JS-APIs as the interfaces to be replaced. Further, step 101 can be implemented by obtaining input information from relevant personnel.

[0038] The target interface can be a JS-API recognizable by a browser with a first-type kernel, and the operation behavior performed by the target interface is consistent with that of the interface to be replaced. Specifically, embodiments of the present invention can simulate the operation behavior performed by the interface to be replaced in a browser with a first-type kernel to obtain a target interface recognizable by the browser with a first-type kernel. Further, embodiments of the present invention can replace the interface to be replaced with the target interface in the program of a web application to be run, and then run the replaced web application. Thus, during operation, the operation behavior of the target interface performing the interface to be replaced can be directly identified.

[0039] It's worth noting that the usage rate of Internet Explorer (IE) in various fields has gradually declined, Microsoft has stopped maintaining it, its market share has dropped significantly, and it no longer receives new security updates and feature improvements. However, many enterprises and organizations in China still run web applications developed based on IE. The Trident rendering engine used by IE is significantly inferior to the Blink and Gecko engines of modern browsers (such as Chrome, Firefox, Edge, and Chromium) in terms of performance, security, and compatibility. Furthermore, since IE no longer receives security updates, web applications developed based on IE are vulnerable to various network attacks and malware threats. Modern web applications emphasize a fast, smooth, and responsive user experience, which IE-based applications often fail to meet. Therefore, with technological advancements, IE-based web applications may require more customized development and maintenance to adapt to ever-changing business needs and technological environments.

[0040] Currently, a related technology employs a dual-core browser solution (such as 360 Security Browser, Sogou High-Speed ​​Browser, QQ Browser, etc.) to ensure compatibility with Internet Explorer applications. Specifically, a dual-core browser typically contains two kernels: one is the IE kernel, used for compatibility with older websites and specific applications like online banking; the other is the Blink kernel, used for accessing modern websites, providing faster speeds and a better user experience. Dual-core browsers automatically select the appropriate kernel for rendering based on the type of webpage being accessed, eliminating the need for manual switching and ensuring the best experience for users visiting different websites. Furthermore, having two kernels allows for compatibility with more websites and applications, providing better support, especially for high-security transactions like online banking and payments. However, current dual-core browsers often only support Microsoft Windows operating systems, making them unusable on other operating systems. Running two kernels simultaneously also consumes more memory and CPU resources, resulting in higher costs.

[0041] Another related technology utilizes cloud services or virtualization solutions to ensure compatibility with Internet Explorer (IE) applications. Specifically, cloud services can provide cloud-based browser instances containing IE, allowing users to access these instances through any browser and indirectly run applications requiring IE. Virtualization solutions use virtualization software to create virtual machines containing IE. These virtual machines can include only the necessary software and configuration to ensure maximum compatibility and stability. Users can deploy these virtual machines locally or in the cloud and manage them through a virtualization platform, achieving IE application compatibility. Thus, cloud services or virtualization solutions can solve compatibility issues, improve flexibility and scalability, reduce maintenance costs, and enhance security. However, virtualization technology requires an additional virtualization layer to manage the virtual environment, which may lead to some performance degradation. Especially when handling complex applications or a large number of concurrent requests, the performance of the virtualization environment may be affected. Furthermore, the management and maintenance of virtualization technology and cloud services require certain professional knowledge and skills, demanding a high level of expertise from maintenance personnel and requiring significant investment in building virtualization platforms or maintaining cloud services.

[0042] Based on this, the first type of kernel mentioned above can be the Blink kernel, and the second type of kernel mentioned above can be the IE kernel.

[0043] In summary, the web application running method provided by this invention is applied to a browser using a first-type kernel. It involves obtaining the interface to be replaced used by the web application to be run; the web application to be run is created based on a second-type kernel, and the interface to be replaced is an application programming interface (API) incompatible with the browser; a target interface is created based on the interface to be replaced; the target interface is an API recognizable by the browser, and the operation behavior performed by the target interface is consistent with that of the interface to be replaced; the target interface is used to replace the interface to be replaced in the web application to be run, and the replaced web application is then run. Thus, by creating an API recognizable by a browser using a first-type kernel and ensuring that the operation behavior performed by the created target interface is consistent with that of an incompatible API, this invention enables the web application to be run compatiblely in a browser using a first-type kernel after replacing the incompatible API with the target interface. This allows for direct execution on the current browser without the need for virtualization, reducing costs.

[0044] This invention achieves interface compatibility through a layered adaptation model of interface semantic migration. Interface structure adaptation ensures the callability of the target interface in a first-type kernel; interface behavior adaptation ensures consistency between the execution result of the target interface and the operational behavior in a second-type kernel. The interface behavior mapping rules are integrated throughout the entire process of interface structure and behavior adaptation, providing unified guidance for interface structure construction and execution behavior adjustment. This invention divides the interface compatibility problem into two levels: interface structure adaptation and interface behavior adaptation. Based on the interface behavior mapping rules, it achieves the migration of interface execution semantics between different browser kernels, thereby enabling compatible operation of web applications without switching browser kernels or relying on virtualization or cloud environments. This approach offers advantages such as low implementation cost, strong compatibility, and high adaptation accuracy.

[0045] Optionally, the interface to be replaced includes a first type of interface that is not recognized by the browser; the construction or determination of the target interface based on the interface behavior mapping rules includes: S21. Add an interface declaration for the target interface to the interface definition file of the first type of kernel. The interface declaration is used to define the interface name, method signature and attribute information to complete the registration of the target interface. S22. Based on the interface declaration, construct the return object of the target interface, and set the attributes and methods corresponding to the second type of kernel interface in the return object to form an interface structure that matches the second type of kernel interface.

[0046] The adjustment of the execution behavior of the target interface based on the interface behavior mapping rule includes: S23. Based on the interface behavior mapping rules, configure execution logic for each method of the target interface; S24. In the execution logic, the application programming interface provided by the first type of kernel is called to implement the function corresponding to the second type of kernel interface; S25. Set state update logic in the execution logic to update the state information of the target interface during method execution; S26. An event triggering mechanism is set in the execution logic to trigger a corresponding event when a preset condition is met, so as to achieve event response behavior consistent with the second type of kernel interface.

[0047] In this way, the target interface has both a callable interface structure in the first type of kernel and execution semantics consistent with the interface to be replaced in the second type of kernel.

[0048] The aforementioned interface definition file refers to the file used to define Web API interfaces. It is written in Interface Definition Language (IDL) and is used to define the interfaces for interaction between browsers and web applications. Therefore, in order for the browser to recognize the target interface, the interface to be created can be added to the interface definition file.

[0049] Specifically, the interface to be created can be defined in the interface definition file based on the Idl. The interface name can be the same as the interface name of the interface to be replaced; this embodiment of the invention does not impose any restrictions on this. For example, taking a browser with a first-type kernel using the Windows operating system as an example, the aforementioned interface definition file can be window.Idl.

[0050] Furthermore, a return object can be created for the interface to be created, and properties and methods consistent with the interface to be replaced can be created for the return object, so that the interface to be created at this time can be used as the target interface.

[0051] The above-mentioned returned object refers to the content returned when calling the interface, which is usually structured data. The above-mentioned attributes refer to the specific data stored inside the returned object. The above-mentioned methods refer to the operations that the returned object can perform.

[0052] For example, taking the first type of kernel as Blink and the second type as the IE kernel, and using the `window.createPopup()` interface in the web application to be run, this interface can be used to create a new popup window. However, this popup window differs from a regular browser window created via `window.open()`. The popup window created by `window.createPopup()` (also known as a "floating frame" or "floating window") visually and behaviorally resembles an independent layer on the browser page, rather than a completely new browser window or tab. However, `window.createPopup()` is not part of the HTML or JavaScript standard; it is a feature specific to Internet Explorer. Therefore, popup windows created using this method may not work correctly in other browsers, or may not be supported at all. Based on this, it can be considered as a replacement interface.

[0053] Specifically, in Internet Explorer, `window.createPopup` can be called using `var popup = window.createPopup()`, which returns a popup window object. The returned popup window object contains the following properties and methods: 1) The popup.document property: returns a reference to the document object in the popup.

[0054] 2) The Popup.isOpen property: returns a boolean value indicating whether the current popup window is displayed.

[0055] 3) The Popup.hide() method closes the current window.

[0056] 4) Method Popup.show(ix, iy, iwidth, iheight, element): Displays the current window.

[0057] In this parameter list, `ix` is a required parameter specifying the x-coordinate of the popup window in pixels (px). `iy` is a required parameter specifying the y-coordinate of the popup window in pixels (px). `iwidth` is a required parameter specifying the width of the popup window in pixels (px). `iheight` is a required parameter specifying the height of the popup window in pixels (px). `Element` is an optional parameter specifying the element relative to the popup window's position and size; if not specified, it defaults to the current desktop element.

[0058] Specifically, popup windows displayed in IE are created using the `window.createPopup()` interface and then displayed using the `show` method mentioned above. Popup windows can be closed using the `hide` method mentioned above; they will also close when the window loses focus in the browser (e.g., when switching windows, clicking outside the popup window, etc.).

[0059] Accordingly, after obtaining the return object, properties, and methods of the interface to be replaced (window.createPopup()) in this embodiment of the invention, the interface to be replaced can be added to window.Idl, and a return object can be created for it. Simultaneously, the document and isOpen properties and hide and show methods mentioned above can be created in this return object. The return object can be a newly added class object.

[0060] In this embodiment of the invention, the interface to be replaced includes a first type of interface that is not recognized by the browser. The interface to be created is added to the browser's interface definition file. A return object is created for the interface to be created, and attributes and methods consistent with the interface to be replaced are created for the return object, thus obtaining the target interface. In this way, when the interface to be replaced is not recognized by the browser, a target interface that is recognized by the browser and whose operation behavior is consistent with the interface to be replaced can be added to the browser's interface definition file, providing a foundation for the compatible operation of the application.

[0061] Optionally, the above-described operation of creating attributes and methods consistent with the interface to be replaced for the returned object to obtain the target interface may specifically include: S31. Based on the first type of kernel-compatible application programming interface, create attributes and methods for the returned object that are consistent with the interface to be replaced, and obtain the target interface.

[0062] Specifically, since the properties and methods of the returned objects of some interfaces are often quite complex, in order to improve processing efficiency, the creation process can be based on the first type of kernel-compatible API implementation, that is, the properties and methods of the returned objects of the interface to be replaced can be simulated using the first type of kernel-compatible API.

[0063] For example, taking the interface to be replaced as window.createPopup(), to simulate this interface, a PopupDocument object can be created first. Then, an empty window object (DOMWindow) can be opened by simulating the call to the Blink kernel-compatible interface window.open, but it is not displayed. Furthermore, since the popup window created by the interface window.createPopup() is an independent layer on the browser page, to ensure the accuracy of simulating this interface, this embodiment of the invention can use this DOMWindow to encapsulate the PopupDocument object. This ensures that even if the popup window is displayed for a long time without being processed, it will not be destroyed or cleaned up.

[0064] Furthermore, a method consistent with the `show` method described above can be created: window style properties can be set in the returned object `popup.document`, and then it can be appended to the current page for display using the Blink kernel-compatible interface `appendChild`, while simultaneously updating the `isOpen` property to `true`. Here, `appendChild` is an interface within the Blink kernel used to add child nodes to the DOM tree.

[0065] Furthermore, a method consistent with the `hide` method described above can be created: the window can be removed from the current page using the `removeChild` interface, which is compatible with the Blink kernel, while simultaneously updating the `isOpen` property to `false`. Here, `removeChild` is an internal Blink kernel interface used to remove child nodes from the current DOM element.

[0066] Furthermore, based on the implementation semantics of `window.createPopup()`, the popup window is primarily displayed using the `show` method. However, besides calling the `hide` method, it can also be hidden by switching windows or clicking outside the popup window area to make it out of focus. Based on this behavior, this embodiment of the invention can implement the hiding operation of the popup window in the Blink kernel for scenarios such as page switching (mouse click and ALT+TAB keyboard operation switching). That is, after capturing these scenarios in the Blink kernel, the aforementioned `hide` and `show` methods are called to show and hide the popup.

[0067] In this embodiment of the invention, based on the first type of kernel-compatible application programming interface, attributes and methods consistent with the interface to be replaced are created for the returned object to obtain the target interface. In this way, after obtaining an unrecognizable interface, attributes and methods consistent with the interface to be replaced can be implemented in the first type of kernel browser, thereby facilitating the presentation of the same functionality as the second type of kernel on the first type of kernel browser and achieving compatibility of the interface to be replaced.

[0068] Optionally, the interface to be replaced includes a second type of interface that is recognizable by the browser and whose operational behavior is inconsistent in the first type of kernel and the second type of kernel; the adjustment of the execution behavior of the target interface based on the interface behavior mapping rule specifically includes: determining the execution logic corresponding to each method in the target interface based on the interface behavior mapping rule; configuring or replacing at least one processing procedure of the target interface according to the execution logic, the processing procedure including at least one of the following: method call procedure, parameter processing procedure, return result generation procedure, state update procedure and / or event triggering procedure, so that the execution behavior of the target interface in the first type of kernel matches the expected semantics of the second type of kernel interface. For example, it may include: S41. Based on the first type of kernel-compatible application programming interface, modify the operation behavior of the interface to be replaced in the browser to obtain the target interface.

[0069] The second type of interface mentioned above refers to interfaces that browsers can recognize but whose operational behavior differs between the first and second type of kernels. Specifically, the browser-recognizable interface indicates that both the first and second type of kernels support the second type of interface. However, due to the inconsistent operational behavior in different kernels, the interface will exhibit different behaviors when running on the second type of kernel, which may lead to errors or poor performance. Therefore, compatibility handling can be applied to this type of interface.

[0070] Specifically, for this type of interface, the operation behavior performed by the interface can be modified directly in the first type of kernel browser so that the operation behavior of the modified target interface is consistent with that of the interface to be replaced.

[0071] In this embodiment of the invention, the interface to be replaced includes a second type of interface that is recognizable by the browser and whose operational behavior is inconsistent in the first type of kernel and the second type of kernel. Based on an application programming interface compatible with the first type of kernel, the operational behavior of the interface to be replaced is modified in the browser to obtain the target interface. In this way, by modifying the behavior alone, the operational behavior of the second type of interface can be simulated in the first type of kernel, so that the behavior of the two is consistent and compatible operation is achieved.

[0072] Optionally, the operation of modifying the behavior of the interface to be replaced in the browser described above may specifically include, in this embodiment of the invention: S51. Obtain the operation behavior performed by the interface to be replaced in the first type of kernel as the first behavior.

[0073] S52. Obtain the operation behavior performed by the interface to be replaced in the second type of kernel as the second behavior.

[0074] S53. Based on the comparison result of the first behavior and the second behavior, modify the first behavior in the browser to make the first behavior consistent with the second behavior.

[0075] Specifically, in this embodiment of the invention, the operation behavior of the interface to be replaced can be obtained in the first type of kernel and the second type of kernel, and the two can be compared. Then, the first behavior can be modified according to the comparison result.

[0076] Specifically, the first behavior and the second behavior can be obtained based on the implementation semantics of the interface to be replaced in the first type of kernel and the second type of kernel, respectively. Furthermore, the two can be compared, and a comparison result can be generated based on the inconsistent behaviors.

[0077] For example, taking the first type of kernel as blink, the second type of kernel as the IE kernel, and the interface to be replaced as window.close, it is used to close the current window via JS.

[0078] In the IE engine, window.close includes the following behavior: Behavior 1: If the current window is a child window (opened via window.showModalDialog or window.open), the window can be closed directly using window.close.

[0079] Behavior 2: If the current window is a child window, window.close can still close the current child window even if it is executed in the iframe of the child window.

[0080] Behavior 3: If the current window is not a child window and there are no open child windows, window.close will display a confirmation dialog box when closing the window, but executing window.close in an iframe will not close the current main window.

[0081] Behavior 4: If the current window is not a child window and there is an open child window, if the child window is opened with window.showModalDialog, the main window cannot be closed; if the child window is opened with window.open, it can be closed and a confirmation dialog will pop up.

[0082] In the Blink kernel, window.close includes the following behavior: Behavior 1: Consistent with Behavior 1 in the IE kernel.

[0083] Behavior 2: If the current window is a child window, window.close is executed within the child window's iframe and cannot be closed.

[0084] Behavior 3: If the current window is not a child window and there are no open child windows, close it directly.

[0085] Behavior 4: If the current window is not a child window and there are already open child windows, close the window without displaying a confirmation dialog.

[0086] Based on the above, the comparison results show three inconsistencies between the first and second behaviors: In behavior 2, IE can close the window, while the Blink kernel cannot. In behavior 3, IE will display a confirmation dialog for the user to confirm closing or canceling, while the Blink kernel will close it directly. In behavior 4, IE distinguishes between child windows opened by `window.showModalDialog` and `window.open`, while the Blink kernel does not distinguish between them and closes them both without displaying a confirmation dialog.

[0087] Based on this, embodiments of the present invention can modify the first behavior in the Blink kernel browser. Specifically, regarding behavior 2 above, the Blink kernel determines that non-MainFrames cannot be closed. To support IE behavior, it needs to support closing the iframe of the child window, but the iframe of the main window still cannot be closed using window.close. To address this behavior, embodiments of the present invention can add a check to determine whether the current frame's context (parent) contains an opener. Specifically, an opener setting can be added to the Blink kernel for the frame, which can then be directly obtained later. Here, the frame's opener refers to the frame that was opened based on it. For example, if a child window B is opened on window A using window.open, then the opener of B is A.

[0088] To address behavior 3 above, a main window check can be added to the Blink kernel (i.e., the opener is empty and the parent is the current window), and then the Blink-compatible confirm interface can be called to implement the pop-up confirmation function.

[0089] To address behavior 4 above, we can add recognition of the window.showModalDialog dialog box to the Blink kernel. We can modify it so that it is located inside the window.close interface and returns directly when the child window of the current window is recognized as a showModalDialog dialog box.

[0090] In this embodiment of the invention, the operation behavior executed by the interface to be replaced in the first type of kernel is obtained as a first behavior; the operation behavior executed by the interface to be replaced in the second type of kernel is obtained as a second behavior; based on the comparison result of the first behavior and the second behavior, the first behavior is modified in the browser to make the first behavior consistent with the second behavior. In this way, the API of the second type of kernel can run normally on the browser with the first type of kernel, completing the compatibility support for web applications with the second type of kernel. Furthermore, since it only needs to be implemented on browsers with the first type of kernel, it can greatly facilitate user operation and also provide support for the migration of other web applications with the second type of kernel.

[0091] Figure 2 This is a schematic diagram of the structure of an application running device according to an embodiment of the present invention, applied to a browser using a first-type kernel, such as... Figure 2 As shown, device 20 includes: The first acquisition module 201 is used to acquire the interface to be replaced called in the web application to be run; the interface to be replaced is an application programming interface that has incompatible behavior between the first type of kernel and the second type of kernel. The first creation module 202 is used to obtain the operation behavior of the interface to be replaced in different kernels and generate interface behavior mapping rules based on the behavior differences; The first generation module 203 is used to generate a target interface based on the interface behavior mapping rules. The target interface can be called in the first type of kernel and the execution result in the first type of kernel is consistent with the operation behavior of the interface to be replaced in the second type of kernel. The replacement module 204 is used to replace the interface to be replaced with the target interface in the web application to be run, and to run the replaced web application in a browser with the first type of kernel.

[0092] Optionally, the first generation module includes: An execution submodule is used to construct or determine the target interface based on the interface behavior mapping rules; The adjustment submodule is used to adjust the execution behavior of the target interface based on the interface behavior mapping rules to generate the target interface based on the interface behavior mapping rules.

[0093] Optionally, the first creation module is specifically used to execute the interface to be replaced in the first type of kernel and the second type of kernel respectively, and to collect the input parameters, return results, document object model changes and event triggering information during the interface execution process.

[0094] Optionally, the execution submodule is specifically used for: Add an interface declaration for the target interface to the interface definition file of the first type of kernel. The interface declaration is used to define the interface name, method signature and attribute information to complete the registration of the target interface. Construct a return object of the target interface based on the interface declaration, and set the attributes and methods corresponding to the second type of kernel interface in the return object to form an interface structure that matches the second type of kernel interface.

[0095] Optionally, the adjustment submodule is specifically used for: Based on the interface behavior mapping rules, execution logic is configured for each method of the target interface; in the execution logic, the application programming interface provided by the first type of kernel is called to implement the function corresponding to the second type of kernel interface; in the execution logic, state update logic is set to update the state information of the target interface during method execution; in the execution logic, an event triggering mechanism is set to trigger the corresponding event when a preset condition is met, so as to achieve the event response behavior consistent with the second type of kernel interface.

[0096] Optionally, the adjustment submodule is specifically used for: Based on the interface behavior mapping rules, determine the execution logic corresponding to each method in the target interface; According to the execution logic, at least one processing procedure of the target interface is configured or replaced, the processing procedure including at least one of the following: method invocation procedure, parameter processing procedure, return result generation procedure, state update procedure and / or event triggering procedure, so that the execution behavior of the target interface in the first type of kernel matches the expected semantics of the second type of kernel interface.

[0097] In summary, the application running apparatus provided in this embodiment of the invention obtains the interface to be replaced used by the web application to be run; the web application to be run is created based on a second type of kernel, and the interface to be replaced is an application programming interface (API) incompatible with the browser; a target interface is created based on the interface to be replaced; the target interface is an API recognizable by the browser, and the operation behavior performed by the target interface is consistent with that of the interface to be replaced; the target interface is used to replace the interface to be replaced in the web application to be run, and the replaced web application is run. Thus, this embodiment of the invention, by creating a browser-recognizable API of the first type of kernel and ensuring that the operation behavior performed by the created target interface is consistent with that of the browser-incompatible API, enables the web application to be run compatiblely in browsers of the first type of kernel after replacing the browser-incompatible API with the target interface. It can run directly on the current browser without requiring a virtualization scheme, and without incurring high costs.

[0098] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0099] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0100] Regarding the request processing apparatus in the above embodiments, the specific manner in which each module performs its operations has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0101] This invention also provides an electronic device, including: a processor and a memory for storing processor-executable instructions, wherein the processor is configured to execute the above-described application running method.

[0102] Reference Figure 3 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Figure 3As shown, the electronic device includes: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface communicate with each other through the communication bus. The memory is used to store at least one executable instruction, which causes the processor to execute the application running method of the aforementioned embodiment.

[0103] It should be noted that the electronic devices in the embodiments of this application include mobile electronic devices and non-mobile electronic devices.

[0104] The processor can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), a FPGA (Field Programmable Gate Array), or other programmable devices, transistor logic devices, hardware components, or any combination thereof. The processor can also be a combination that implements computational functions, such as a combination of one or more microprocessors, or a combination of a DSP and a microprocessor.

[0105] The communication bus may include a path for transmitting information between the memory and the communication interface. The communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 The symbol is represented by only one line, but this does not mean that there is only one bus or one type of bus.

[0106] The memory may be ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or it may be EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disk Read Only), magnetic tape, floppy disk and optical data storage devices, etc.

[0107] This invention also provides a non-transitory computer-readable storage medium that, when instructions in the storage medium are executed by a processor of an electronic device (server or terminal), enables the processor to perform... Figure 1 The application execution method is shown.

[0108] This invention also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform... Figure 1 The application execution method is shown.

[0109] This application also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above application running method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0110] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0111] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0112] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented wholly or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid state disks (SSDs)).

[0113] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0114] These computer program instructions may also be stored in a computer-readable storage medium capable of directing a computer or other programmable data processing terminal device to operate in a predictive manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0115] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0116] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0117] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0118] It should be noted that the various data-related processes in the embodiments of this application are carried out in compliance with the relevant data protection laws and policies of the country where the location is located, and with the authorization granted by the owner of the corresponding device.

[0119] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0120] The present invention has provided a detailed description of an application operation method, apparatus, electronic device, and readable storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A web application running method, characterized by, The method is applied to browsers employing a first-type kernel, and the method includes: Obtain the interfaces to be replaced called in the web application to be run; the interfaces to be replaced are application programming interfaces that have incompatible behaviors between the first type of kernel and the second type of kernel. Obtain the operational behavior of the interface to be replaced in different kernels, and generate interface behavior mapping rules based on the behavior differences; A target interface is generated based on the interface behavior mapping rules. The target interface can be called in the first type of kernel and the execution result in the first type of kernel is consistent with the operation behavior of the interface to be replaced in the second type of kernel. The target interface is replaced in the web application to be run, and the replaced web application is run in a browser with the first type of kernel.

2. The method of claim 1, wherein, Generate the target interface based on the interface behavior mapping rules, including: The target interface is constructed or determined based on the interface behavior mapping rules; The execution behavior of the target interface is adjusted based on the interface behavior mapping rules to generate the target interface based on the interface behavior mapping rules.

3. The method of claim 1, wherein, Obtaining the operational behavior of the interface to be replaced in different kernels includes: The interface to be replaced is executed in the first type of kernel and the second type of kernel respectively, and the input parameters, return results, document object model changes and event triggering information during the interface execution process are collected.

4. The method of claim 2, wherein, The interfaces to be replaced include the first type of interfaces that the browser cannot recognize; the construction or determination of the target interface based on the interface behavior mapping rules includes: Add an interface declaration for the target interface to the interface definition file of the first type of kernel. The interface declaration is used to define the interface name, method signature and attribute information to complete the registration of the target interface. Based on the interface declaration, construct the return object of the target interface, and set the attributes and methods corresponding to the second type of kernel interface in the return object to form an interface structure that matches the second type of kernel interface.

5. The method of claim 4, wherein, The adjustment of the execution behavior of the target interface based on the interface behavior mapping rule includes: Based on the interface behavior mapping rules, configure execution logic for each method of the target interface; In the execution logic, the application programming interface provided by the first type of kernel is called to implement the function corresponding to the second type of kernel interface; A state update logic is set in the execution logic to update the state information of the target interface during method execution; An event triggering mechanism is set in the execution logic to trigger a corresponding event when preset conditions are met, so as to achieve event response behavior consistent with the second type of kernel interface.

6. The method of claim 2, wherein, The adjustment of the execution behavior of the target interface based on the interface behavior mapping rule includes: Based on the interface behavior mapping rules, determine the execution logic corresponding to each method in the target interface; According to the execution logic, at least one processing procedure of the target interface is configured or replaced, the processing procedure including at least one of the following: method invocation procedure, parameter processing procedure, return result generation procedure, state update procedure and / or event triggering procedure, so that the execution behavior of the target interface in the first type of kernel matches the expected semantics of the second type of kernel interface.

7. The method according to any one of claims 1 to 6, characterized in that, The interface behavior mapping rules are established at the interface level, method level, or parameter level respectively, and stored in the form of configuration files, interface description files, or mapping tables.

8. An application execution device characterized by comprising: The device is used in a browser employing a first-type kernel, and the device includes: The first acquisition module is used to acquire the interface to be replaced called in the web application to be run; the interface to be replaced is an application programming interface that has incompatible behavior between the first type of kernel and the second type of kernel. The first creation module is used to obtain the operation behavior of the interface to be replaced in different kernels and generate interface behavior mapping rules based on the behavior differences; The first generation module is used to generate a target interface based on the interface behavior mapping rules. The target interface can be called in the first type of kernel and the execution result in the first type of kernel is consistent with the operation behavior of the interface to be replaced in the second type of kernel. The replacement module is used to replace the interface to be replaced with the target interface in the web application to be run, and to run the replaced web application in a browser with the first type of kernel.

9. An electronic device, comprising: It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.