Native application and web page interaction method and device and electronic equipment
By using configuration files, interaction items and their processing objects are uniformly mapped, and interaction rules are uniformly mapped, thus achieving standardized two-way communication between native applications and web pages. This solves the problems of fragmentation and non-standardization in the interaction process, improves interaction efficiency and stability, and meets the flexibility of individual needs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-04-03
AI Technical Summary
In existing technologies, feature updates or bug fixes for native applications require a cumbersome review process, which leads to extended development cycles and makes it difficult to meet the market's demand for rapid business response. At the same time, the dispersed deployment of interaction processes results in poor consistency of interaction logic, affecting interaction efficiency and stability.
By pre-setting configuration files, interactive items and item processing objects are uniformly mapped. Interaction rules are unified using target interfaces, and bidirectional communication between native applications and web pages is standardized. Furthermore, registration logic is associated through configuration files, supporting batch registration and dynamic adjustments to adapt to complex business iteration needs.
It improves interaction efficiency, reduces coupling, ensures consistency of interaction matters, enhances system flexibility and stability, and meets the flexibility of individual needs.
Smart Images

Figure CN121792503A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a method, apparatus, and electronic device for native application and web page interaction. Background Technology
[0002] With the rapid development of mobile internet technology and the increasing diversification of user needs, mobile applications are demanding ever-increasing speeds of feature iteration and improved user experience. Currently, the traditional native application development model is one of the main ways to build mobile applications. While this model ensures application performance and user interaction, it has significant limitations when facing frequent changes in business requirements. For example, native application feature updates or bug fixes require a cumbersome application review process, leading to extended development cycles and slow feature deployment, making it difficult to meet the market's demand for rapid business response.
[0003] Currently, in the hybrid development model, some business functions are typically migrated to web pages to compensate for the lack of iteration efficiency of native applications through the flexibility of web pages. However, because the interaction process is deployed in different business modules, the consistency of the interaction logic is poor, which can easily lead to interaction anomalies and affect interaction efficiency and stability. Summary of the Invention
[0004] This application provides a method, apparatus, and electronic device for native application and web page interaction, which can solve the problems of fragmented and unstable existing interaction processes.
[0005] In a first aspect, embodiments of this application provide a method for interaction between a native application and a web page, including:
[0006] Parse the parameter information carried by the business to be processed to obtain at least one item to be interacted with;
[0007] The task processing object corresponding to each interactive task is determined based on a pre-set configuration file; the configuration file includes a mapping relationship between all interactive tasks and the task processing objects that implement all interactive tasks;
[0008] Each of the items to be interacted is processed according to the pre-set interaction message rules; the interaction message rules stipulate that all interactions with the web page use the target interface.
[0009] Each of the processed items to be interacted with is sent to the corresponding item processing object in the native application, and the item processing result fed back by the native application is processed according to the interaction message rules and then sent to the web page.
[0010] Compared to existing technologies, this application solves the problems of fragmented interaction processes and inconsistent interaction formats by pre-setting configuration files and uniformly mapping interactive items to item processing objects. It also addresses these issues by pre-setting interaction message rules and unifying interaction rules between the target interface and the web page. This standardizes bidirectional communication between native applications and web pages, reducing coupling. Furthermore, by sending each interactive item to its corresponding item processing object, interaction efficiency can be improved.
[0011] As an optional implementation, after parsing the parameter information carried by the service to be processed to obtain at least one interaction item, the method further includes:
[0012] The configuration file is used to determine the registration logic for each interactive item; the configuration file also includes the basic registration logic for the target interactive item.
[0013] Register the corresponding items to be interacted with simultaneously according to the registration logic described above.
[0014] In this embodiment, registration logic is associated with a configuration file, enabling batch registration of multiple items to be interacted with. This replaces the traditional manual registration method, improving interaction efficiency and reducing maintenance costs. Furthermore, a unified management of the registration process ensures consistency in the registration of each item, preventing omissions or duplicate registrations.
[0015] As an optional implementation, after determining the registration logic corresponding to each interactive item based on the configuration file, the method further includes:
[0016] If no interactive item is matched in the configuration file, the configuration file is dynamically adjusted based on the unmatched interactive item, without modifying the basic registration logic.
[0017] In this embodiment, the expansion of interactive items can be achieved by dynamically adjusting the configuration file without modifying the basic registration logic, thus adapting to the frequent iteration needs of complex businesses.
[0018] As an optional implementation, the interaction item types include general needs and personalized needs. If there is a personalized need among the items to be interacted with, after processing each item according to the pre-set interaction message rules, the method further includes:
[0019] Based on the individual needs, special processing logic is configured for the corresponding interactive items; wherein the special processing logic is determined after the interaction message rules are processed based on the data carried by the interactive item that is different from other interactive items.
[0020] This application embodiment supports special processing for individual needs based on the setting of unified interactive message rules, which not only ensures the overall interaction standard, but also adapts to unique business scenarios and improves system flexibility.
[0021] Secondly, embodiments of this application provide a native application and web page interaction device, including:
[0022] The parsing module is used to parse the parameter information carried by the business to be processed and obtain at least one item to be interacted with.
[0023] The determination module is used to determine the task processing object corresponding to each interactive task based on a pre-set configuration file; the configuration file includes a mapping relationship between all interactive tasks and the task processing objects that implement all interactive tasks;
[0024] The processing module is used to process each of the interactive items according to the pre-set interaction message rules; the interaction message rules stipulate that all interactions with the web page use the target interface.
[0025] The interaction module is used to send each of the processed items to be interacted to the corresponding item processing object in the native application, and to process the item processing results fed back by the native application according to the interaction message rules and send them to the web page.
[0026] As an optional implementation, the parsing module is further configured to:
[0027] The configuration file is used to determine the registration logic for each interactive item; the configuration file also includes the basic registration logic for the target interactive item.
[0028] Register the corresponding items to be interacted with simultaneously according to the registration logic described above.
[0029] As an optional implementation, the parsing module is further configured to:
[0030] If no interactive item is matched in the configuration file, the configuration file is dynamically adjusted based on the unmatched interactive item, without modifying the basic registration logic.
[0031] As an optional implementation, the interaction item types include general needs and personalized needs. If the type of the interaction item is a personalized need, the processing module is further configured to:
[0032] Based on the individual needs, special processing logic is configured for the corresponding interactive items; wherein the special processing logic is determined after the interaction message rules are processed based on the data carried by the interactive item that is different from other interactive items.
[0033] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the processor enables the processor to implement any of the native application and web page interaction methods described in the first aspect above.
[0034] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the native application and web page interaction methods in the first aspect.
[0035] Fifthly, embodiments of this application also provide a computer program product, including a computer program executed by a processor to implement any of the native application and web page interaction methods described in the first aspect above.
[0036] The technical effects of any of the implementation methods in aspects two through five can be found in the technical effects of the corresponding implementation methods in aspect one, and will not be repeated here. Attached Figure Description
[0037] Figure 1 This application provides an illustration of an application scenario for a native application and web page interaction method.
[0038] Figure 2 This application provides a schematic diagram of a method for interaction between a native application and a web page, as illustrated in an embodiment of the present application.
[0039] Figure 3 This application provides a schematic diagram of a method for interaction between a native application and a web page, as illustrated in an embodiment of the present application.
[0040] Figure 4 This application provides a schematic diagram of the structure of a native application and web page interaction device.
[0041] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0043] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data used can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0044] The following explanations of some terms used in the embodiments of this application are provided to facilitate understanding by those skilled in the art.
[0045] (1) In the embodiments of this application, the term "multiple" refers to two or more, and other quantifiers are similar.
[0046] (2) A server is a service provided to a terminal, and the services include processing the interactive information between native applications and web pages; a server is the counterpart to the application installed on the terminal device and works in conjunction with the application on the terminal device.
[0047] (3) Terminal devices can refer to both software applications (APPs) and client devices. They have a visual display interface that allows interaction with the user; they correspond to a server and provide local services to the client. For software applications, except for some applications that run only locally, they are generally installed on ordinary client terminals and need to cooperate with the server to run. With the development of the Internet, commonly used applications include email clients for sending and receiving emails, and instant messaging clients. For these types of applications, corresponding servers and service programs are needed on the network to provide services such as database services and configuration parameter services. Therefore, a specific communication connection needs to be established between the client terminal and the server to ensure the normal operation of the application.
[0048] Currently, with the rapid development of mobile internet technology and the increasing diversification of user needs, mobile applications are demanding ever-increasing speeds of feature iteration and improved user experience. Among existing technologies, the traditional native application development model is one of the main ways to build mobile applications. While this model ensures application performance and user interaction, it has significant limitations when facing frequent changes in business requirements. For example, native application feature updates or bug fixes require a cumbersome application review process, leading to extended development cycles and slow feature deployment, making it difficult to meet the market's demand for rapid business response.
[0049] Currently, in the hybrid development model, some business functions are typically migrated to web pages to compensate for the lack of iteration efficiency of native applications through the flexibility of web pages. However, because the interaction process is deployed in different business modules, the consistency of the interaction logic is poor, which can easily lead to interaction anomalies and affect interaction efficiency and stability.
[0050] To address this, embodiments of this application provide a method, apparatus, and electronic device for interaction between native applications and web pages. By pre-setting configuration files, interactive items and item processing objects are uniformly mapped using these files. Furthermore, by pre-setting interaction message rules, the interaction rules between the target interface and the web page are unified, resolving the issues of fragmented interaction processes and non-standardized interaction formats. This achieves standardization of bidirectional communication between native applications and web pages, reducing coupling. By sending each interactive item to its corresponding item processing object, interaction efficiency can be improved.
[0051] After introducing the design concept of the embodiments of this application, the following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of this application can be applied. It should be noted that the application scenarios described below are only for illustrating the embodiments of this application and are not intended to limit the scope. In specific implementation, the technical solutions provided by the embodiments of this application can be flexibly applied according to actual needs.
[0052] refer to Figure 1 This is a schematic diagram illustrating an application scenario for the native application and web page interaction method provided in this application embodiment. The application scenario includes terminal device 101 (e.g., a mobile phone), terminal device 102 (e.g., a computer), and server 103. Terminal device 101 and server 103, as well as terminal device 102 and server 103, are connected via wireless or wired networks. Terminal device 101 or terminal device 102 includes, but is not limited to, desktop computers, mobile phones, mobile computers, tablets, media players, smart wearable devices, smart TVs, and other electronic devices. Server 103 can be a single server, a server cluster consisting of several servers, or a cloud computing center. Server 103 can be an independent physical server, a server cluster consisting of multiple physical servers, or a distributed system. It can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0053] Taking a scenario where terminal device 101 is a mobile phone running iOS and terminal device 102 is a computer displaying a web page, with server 103 acting as a bridge for interaction between terminal devices 101 and 102, as an example, the process is as follows: Terminal device 102 sends a pending task to server 103. Upon receiving the pending task, server 103 parses the parameter information carried by the task to obtain at least one interactive item. Then, based on a pre-set configuration file, it determines the corresponding task processing object for each interactive item. The configuration file includes a mapping relationship between all interactive items and the task processing objects that implement all interactive items. Each interactive item is then processed according to pre-set interaction message rules. Finally, each processed interactive item is sent to the corresponding task processing object in the native application of terminal device 101, and the task processing result returned by the native application of terminal device 101 is sent to server 103. Server 103 processes the result according to the interaction message rules and sends it to the web page of terminal device 102 for display.
[0054] Of course, the methods provided in the embodiments of this application are not limited to... Figure 1 The application scenarios shown can also be used in other possible scenarios, and this application does not impose any limitations. Figure 1 The functions that each device in the application scenario shown can achieve will be described in subsequent method embodiments, and will not be elaborated on here.
[0055] To further illustrate the technical solutions provided in the embodiments of this application, a detailed description is provided below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of this application provide method operation steps as shown in the following embodiments or drawings, the method may include more or fewer operation steps based on conventional or non-inventive methods. In steps where there is no logically necessary causal relationship, the execution order of these steps is not limited to the execution order provided in the embodiments of this application.
[0056] The following is combined with Figure 1 The application scenarios shown are as follows: Figure 2 As shown, the native application and web page interaction method provided in this application embodiment will be described in detail, specifically including the following steps:
[0057] S201, parse the parameter information carried by the business to be processed to obtain at least one item to be interacted with.
[0058] For example, an iOS e-commerce app sends a pending business request to the server, which needs to be displayed through a web page. The pending business request is parsed to obtain three interactive items: product details query, order submission, and user information retrieval.
[0059] S202, determine the task processing object corresponding to each task to be interacted with based on the pre-set configuration file.
[0060] Optionally, the configuration file includes a mapping between all interactive items and the item handling objects that implement all interactive items. For example, the configuration file (e.g., a plist file) pre-stores the mapping between three interactive items and their corresponding item handling objects; for example, mapping "queryGoods" to the GoodsHandler class and "submitOrder" to the OrderHandler class.
[0061] S203, process each item to be interacted according to the pre-set interaction message rules.
[0062] Optionally, the interaction message rule stipulates that all interactions with the web page use the target interface. For example, the unified interaction message rule is the target interface format of "{methodName: string, params: dictionary, callbackId: string}".
[0063] S204: Send each processed item to be interacted with to the corresponding item processing object in the native application, and send the item processing result fed back by the native application to the web page after processing it according to the interaction message rules.
[0064] For example, when a web page initiates a "queryGoods" request, it obtains the item to be interacted with by parsing the parameter information, then matches the GoodsHandler through the configuration file, processes it according to the unified interaction message rules, calls the native query logic, and then calls back the item processing result to the web page according to the interaction message rules. The entire interaction process does not need to be managed separately, and the interaction format is completely unified.
[0065] For example, let's take the example of a web page calling the payment function of a native application and the native application returning the payment result:
[0066] First, define a basic template, which means formatting the parameter information carried by the business logic to be processed according to the basic template. For example: `(void)handleMessage:(id)message callback:(void(^)(id result))callback`, where `message` represents receiving parameters such as payment amount and order number, and `callback` represents returning the payment status to the web page. Next, set up a configuration file, such as a plist file: add key-value pairs to the plist, set `methodName` to "payOrder", and set `handlePlugin` to the payment processing object "PayHandler", thus completing the mapping between the "method name" of the interactive item and the corresponding item processing object. After completing the configuration file settings, determine the item processing object corresponding to the interactive item based on the pre-set configuration file. Process the interactive items uniformly according to the interaction message rules. Then, after the PayHandler processes the payment logic, return the "payment successful" result to the WebViewBridge through a block callback, and then pass the result to the web page through the `evaluateJavaScript` method, completing the interaction loop.
[0067] During implementation, the web page initiates a request to the native application via webkit.messageHandlers.webViewBridge.postMessage({methodName:"payOrder",params:{amount:100,coupon:YES}}). The native application intercepts the message through the WKScriptMessageHandler delegate method and matches the PayHandler corresponding to "payOrder".
[0068] In one embodiment of this application, after executing step S201, parsing the parameter information carried by the service to be processed, and obtaining at least one interactive item, the registration logic corresponding to each interactive item can be determined based on the configuration file, and then the corresponding interactive items are registered simultaneously according to the registration logic, wherein the configuration file also includes the basic registration logic of the target interactive item.
[0069] For example, the configuration file includes basic registration logic such as registering with userContentController, setting up message brokers, and enabling callback support. After parsing the three interactive items "queryGoods", "submitOrder", and "userInfoGet", the corresponding registration logic is determined from the configuration file. Then, the WebViewBridge class registers the three interactive items to WKWebView's userContentController in batches, eliminating the need to write separate registration code for each interactive item, reducing redundancy, and centralizing the maintenance of the registration logic, thus reducing coupling.
[0070] In one embodiment of this application, after determining the registration logic corresponding to each interactive item based on the configuration file, if no interactive item is matched in the configuration file, the configuration file is dynamically adjusted according to the unmatched interactive item, without modifying the basic registration logic.
[0071] For example, suppose the unmatched interactive item is a coupon redemption function. The web page initiates a "receiveCoupon" request. After parsing, it is determined that there is no mapping and registration logic for this interactive item in the configuration file. At this time, it is only necessary to add the mapping relationship between "receiveCoupon" and CouponHandler in the configuration file and use the existing basic registration logic. There is no need to modify the WebViewBridge class or the original registration code. After the configuration file is dynamically updated, the interactive item will be automatically identified and the registration will be completed, realizing functional expansion. The entire process involves non-intrusive modification of the original core code.
[0072] In one embodiment of this application, the interaction item types include general needs and individual needs. If there is an interaction item of the type of individual needs, after executing step S203 and processing each interaction item according to the pre-set interaction message rules, special processing logic can also be configured for the corresponding interaction item based on the individual needs. The special processing logic is determined based on the data carried by the interaction item that is different from other interaction items after the interaction message rules are processed.
[0073] For example, suppose a web page initiates a "calculateVIPDiscount" request (i.e., a personalized request), with the parameter carrying the differentiated data "vipLevel:3". After parsing the parameters and matching the processing object VIPDiscountHandler according to the unified interaction message rules, special processing logic is configured based on the differentiated data "vipLevel:3", such as "querying the discount rate for VIP level 3, applying order-based discounts, and calculating the final price". By executing this special processing logic based on the unified interaction message rules, consistency with the format of other pending interactions is ensured while meeting the personalized business needs of specific users, without breaking the overall interaction format specifications.
[0074] like Figure 3 As shown, the interaction method between the native application and the web page provided in this application embodiment will be described in detail. Assuming the web page needs to call the native application's "real-name authentication status query" function, and the native application needs to send the query results back to the web page, the specific execution process includes the following steps:
[0075] S301 defines the basic message template.
[0076] For example, a web page sends a pending business request: The web page sends a pending business request to the iOS native application through the specified template webkit.messageHandlers.webViewBridge.postMessage({methodName:"checkReal NameStatus",params:{userId:"123456"}}), where "checkRealNameStatus" is the name of the interaction method agreed upon by both parties, and "userId" is the business parameter.
[0077] Optionally, during the definition of the basic message template, a block-type callback can be defined. The callback parameter is of type id, used to ensure the dynamic nature of business parameters when calling back to the web page. Alternatively, a base class method for message processing can be defined, where parameter 1 is defined to accept the interactive item to be processed, and the aforementioned block-type callback parameter 2 is defined to send the message back to the web page.
[0078] S302, native application intercepts messages.
[0079] For example, the native iOS application intercepts the message through the delegate method userContentController(_:didReceive:) of WKScriptMessageHandler, and parses out the method name "checkRealNameStatus" and the parameter "userId:123456".
[0080] Optionally, the web page sends a message to the native iOS application via the webkit.messageHandlers.alias.postMessage method, which is used to call native code. The native iOS application intercepts the message through the delegate method of WKScriptMessageHandler.
[0081] S303, the native application iterates through the interactive item mapping relationships set in the plist configuration file.
[0082] Specifically, the task handling object corresponding to "checkRealNameStatus" is determined to be the "RealNameHandler" class, and the message is dispatched to the RealNameHandler module through a dynamic class loading mechanism.
[0083] Optionally, a plist configuration file can be created as a container to manage all methods that require interaction between iOS and the web page. Here, the root type of the plist container is changed to NSDictionary, and the specific entries can also be of type NSDictionary. Then, two key-value pairs are added under each specific entry, both of type NSString. Key 1 is named methodName, and the value is the name of the interaction method agreed upon by both iOS and the web page. Key 2 is named handlePlugin, and the value is the object that implements the basic message to handle this business logic. Finally, other entries that need to interact with the web page are added in the same way.
[0084] S304, Business Logic Processing.
[0085] Specifically, after receiving the parameters, the RealNameHandler module calls the native application's real-name authentication query interface to obtain the result "This user has completed real-name authentication".
[0086] S305, native application callback to web page.
[0087] Specifically, RealNameHandler passes the result to WebViewBridge via a block callback, and WebViewBridge then passes the result back to the web page via evaluateJavaScript("window.receiveRealNameResult('Authenticated with real name')").
[0088] S306, Web page receives results.
[0089] For example, the web page receives the callback result through the preset receiveRealNameResult function, updates the page to display "Real-name authentication status: Completed", and completes the two-way communication loop.
[0090] like Figure 4 As shown, this application provides a device for interaction between a native application and a web page, including:
[0091] The parsing module 401 is used to parse the parameter information carried by the business to be processed and obtain at least one item to be interacted with.
[0092] The determination module 402 is used to determine the item processing object corresponding to each interactive item based on a pre-set configuration file; the configuration file includes a mapping relationship between all interactive items and the item processing objects that implement all interactive items;
[0093] The processing module 403 is used to process each interactive item according to the pre-set interaction message rules; the interaction message rules stipulate that all interactions with the web page use the target interface.
[0094] The interaction module 404 is used to send each processed item to be interacted to the corresponding item processing object in the native application, and to process the item processing results fed back by the native application according to the interaction message rules and send them to the web page.
[0095] As an optional implementation, the parsing module 401 is also used for:
[0096] The configuration file determines the registration logic for each interactive item; the configuration file also includes the basic registration logic for the target interactive item.
[0097] Register the corresponding pending interaction items simultaneously according to the registration logic.
[0098] As an optional implementation, the parsing module 401 is also used for:
[0099] If no interactive item is matched in the configuration file, the configuration file is dynamically adjusted based on the unmatched interactive item, without modifying the basic registration logic.
[0100] As an optional implementation, the interaction item types include general requirements and personalized requirements. If there is a personalized requirement for the interaction item, the processing module 403 is further used to:
[0101] Based on individual needs, special processing logic is configured for the corresponding interactive items; the special processing logic is determined after the interaction message rules are processed based on the data carried by the interactive item that is different from other interactive items.
[0102] Having introduced the native application and web page interaction methods and apparatus according to exemplary embodiments of this application, we will now introduce an electronic device according to another exemplary embodiment of this application.
[0103] Those skilled in the art will understand that various aspects of this application can be implemented as a system, method, or program product. Therefore, various aspects of this application can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, collectively referred to herein as a "circuit," "module," or "system."
[0104] In some possible implementations, the electronic device according to this application may include at least one processor and at least one memory. The memory stores program code that, when executed by the processor, causes the processor to perform the steps in the native application and web page interaction methods described above according to various exemplary embodiments of this application. For example, the processor may perform steps such as those in the native application and web page interaction methods.
[0105] The following reference Figure 5 To describe an electronic device 50 according to this embodiment of the present application. Figure 5 The electronic device 50 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0106] like Figure 5 As shown, the electronic device 50 is presented in the form of a general-purpose electronic device. The components of the electronic device 50 may include, but are not limited to: at least one processor 51, at least one memory 52, and a bus 53 connecting different system components (including memory 52 and processor 51).
[0107] Bus 53 represents one or more of several bus structures, including a memory bus or memory controller, peripheral bus, processor, or a local bus using any of the various bus structures.
[0108] The memory 52 may include a readable medium in the form of volatile memory, such as random access memory (RAM) 521 and / or cache memory 522, and may further include read-only memory (ROM) 523.
[0109] The memory 52 may also include a program / utility 525 having a set (at least one) of program modules 524, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0110] Electronic device 50 can also communicate with one or more external devices 54 (e.g., keyboard, pointing device, etc.), and with one or more devices that enable a user to interact with electronic device 50, and / or with any device that enables electronic device 50 to communicate with one or more other electronic devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 55. Furthermore, electronic device 50 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 56. As shown, network adapter 56 communicates with other modules used in electronic device 50 via bus 53. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with electronic device 50, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0111] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 52 including instructions that can be executed by a processor 51 to perform the above-described method. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0112] In an exemplary embodiment, a computer program product is also provided, including a computer program / instructions that, when executed by a processor 51, implement any of the native application and web page interaction methods provided in this application.
[0113] In an exemplary embodiment, various aspects of the native application and web page interaction method provided in this application can also be implemented as a program product, which includes program code. When the program product is run on a computer device, the program code is used to cause the computer device to perform the steps in the native application and web page interaction method according to the various exemplary embodiments of this application described above.
[0114] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0115] The program product for interaction between native applications and web pages according to embodiments of this application can be a portable compact disc read-only memory (CD-ROM) and include program code, and can run on an electronic device. However, the program product of this application is not limited thereto. In this document, the readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0116] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. This propagated data signal may take many forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0117] The program code contained on the readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wired, fiber optic, RF, etc., or any suitable combination thereof.
[0118] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's electronic device, partially on the user's device, as a standalone software package, partially on the user's electronic device and partially on a remote electronic device, or entirely on a remote electronic device or server. In cases involving remote electronic devices, the remote electronic device can be connected to the user's electronic device via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external electronic device (e.g., via the Internet using an Internet service provider).
[0119] It should be noted that although several units or sub-units of the device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided and embodied by multiple units.
[0120] Furthermore, although the operations of the method of this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0121] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0122] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. 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 native application and web page interaction device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable native application and web page interaction 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.
[0123] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable native application to function in a particular manner with a web page interaction device, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction means, the instruction means being implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0124] These computer program instructions can also be loaded onto a computer or other programmable native application and web page interaction device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device 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.
[0125] Although preferred embodiments of this application 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 this application.
[0126] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for interaction between a native application and a web page, characterized in that, include: Parse the parameter information carried by the business to be processed to obtain at least one item to be interacted with; The task processing object corresponding to each interactive task is determined based on a pre-set configuration file; the configuration file includes a mapping relationship between all interactive tasks and the task processing objects that implement all interactive tasks; Each of the items to be interacted is processed according to the pre-set interaction message rules; the interaction message rules stipulate that all interactions with the web page use the target interface; Each of the processed items to be interacted with is sent to the corresponding item processing object in the native application, and the item processing result fed back by the native application is processed according to the interaction message rules and then sent to the web page.
2. The method as described in claim 1, characterized in that, After parsing the parameter information carried by the service to be processed to obtain at least one interaction item, the method further includes: The configuration file is used to determine the registration logic for each interactive item; the configuration file also includes the basic registration logic for the target interactive item. Register the corresponding items to be interacted with simultaneously according to the registration logic described above.
3. The method as described in claim 2, characterized in that, After determining the registration logic corresponding to each interactive item based on the configuration file, the method further includes: If no interactive item is matched in the configuration file, the configuration file is dynamically adjusted based on the unmatched interactive item, without modifying the basic registration logic.
4. The method as described in claim 1, characterized in that, The interaction item types include general needs and personalized needs. If there is a personalized need among the items to be interacted with, after processing each item according to the pre-set interaction message rules, the method further includes: Based on the individual needs, special processing logic is configured for the corresponding interactive items; wherein the special processing logic is determined after the interaction message rules are processed based on the data carried by the interactive item that is different from other interactive items.
5. A device for interaction between a native application and a web page, characterized in that, include: The parsing module is used to parse the parameter information carried by the business to be processed and obtain at least one item to be interacted with. The determination module is used to determine the task processing object corresponding to each interactive task based on a pre-set configuration file; the configuration file includes a mapping relationship between all interactive tasks and the task processing objects that implement all interactive tasks; The processing module is used to process each of the interactive items according to the pre-set interaction message rules; the interaction message rules stipulate that all interactions with the web page use the target interface. The interaction module is used to send each of the processed items to be interacted to the corresponding item processing object in the native application, and to process the item processing results fed back by the native application according to the interaction message rules and send them to the web page.
6. The apparatus as claimed in claim 5, characterized in that, The parsing module is also used for: The configuration file is used to determine the registration logic for each interactive item; the configuration file also includes the basic registration logic for the target interactive item. Register the corresponding items to be interacted with simultaneously according to the registration logic described above.
7. The apparatus as claimed in claim 6, characterized in that, The parsing module is also used for: If no interactive item is matched in the configuration file, the configuration file is dynamically adjusted based on the unmatched interactive item, without modifying the basic registration logic.
8. The apparatus as claimed in claim 5, characterized in that, Interaction item types include general needs and personalized needs. If the type of the interaction item is a personalized need, the processing module is further used to: Based on the aforementioned individual needs, special processing logic is configured for the corresponding interactive items. The special processing logic is determined after the interaction message rules are processed, based on the data carried by the item to be interacted that is different from other items to be interacted.
9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1-4.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that causes the computer to perform the method of any one of claims 1-4.