CN110580156A - Page processing method and device and electronic equipment - Google Patents

Page processing method and device and electronic equipment Download PDF

Info

Publication number
CN110580156A
CN110580156A CN201910775631.3A CN201910775631A CN110580156A CN 110580156 A CN110580156 A CN 110580156A CN 201910775631 A CN201910775631 A CN 201910775631A CN 110580156 A CN110580156 A CN 110580156A
Authority
CN
China
Prior art keywords
plug
request
page
target
response
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201910775631.3A
Other languages
Chinese (zh)
Inventor
王泽鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hanhai Information Technology Shanghai Co Ltd
Original Assignee
Beijing Mobai Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Mobai Technology Co Ltd filed Critical Beijing Mobai Technology Co Ltd
Priority to CN201910775631.3A priority Critical patent/CN110580156A/en
Publication of CN110580156A publication Critical patent/CN110580156A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Landscapes

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

Abstract

The invention discloses a page processing method and device and electronic equipment. The method comprises the following steps: intercepting a page request triggered by a target page; the target page is a web page embedded in a corresponding target native application; converting the page request into an object request, and acquiring a target plug-in for responding to the object request; and calling the target plug-in to respond to the object request, acquiring a corresponding request result and returning the request result to the target page.

Description

Page processing method and device and electronic equipment
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a page processing method and apparatus, and an electronic device.
background
With the rapid development of internet technology and the intelligent popularization of mobile devices, users have been accustomed to browsing Web pages (Web pages) through browsers or Applications (APP) installed on mobile devices such as mobile phones and tablet computers to obtain corresponding application services.
Compared with a Native application page provided by Native application (Native APP), embedding a webpage in the Native application can effectively reduce the installation package size of the Native application, and can quickly and conveniently respond to requirements such as addition, deletion, modification, search and the like related to the page by utilizing the characteristic that the webpage loads codes through a remote end, so that the application processing efficiency is improved.
however, after the native application page in the native application is converted into the embedded web page, the native application still needs to be processed through the user operations (such as adding a menu, deleting a menu, social sharing, order payment, picture uploading, and the like) which are received by the embedded web page and originally occur in the native application page, so that the web page needs to be communicated with the native application, the received operations are transmitted to the native application, and the corresponding operation results are obtained and presented to the user.
the communication between the embedded webpage of the native application and the native application is generally that when the webpage receives an operation request initiated after a user operation, the operation request is intercepted for redirection, and the operation request is converted into a corresponding operation request response returned after the native application is processed. Currently, the interception is usually implemented by developing corresponding interception codes according to each possible operation requirement of each webpage. When a plurality of web pages have the same operation requirement or one web page has a plurality of different operation requirements, redundancy of the intercepted codes is brought, and the redundant intercepted codes bring higher implementation difficulty and higher maintenance cost for code modification and test at the later stage.
Disclosure of Invention
An object of the present invention is to provide a new solution for processing pages.
According to a first aspect of the present invention, there is provided a page processing method, including:
Intercepting a page request triggered by a target page; the target page is a webpage embedded in a corresponding target native application;
Converting the page request into an object request, and acquiring a target plug-in for responding to the object request;
and calling the target plug-in to respond to the object request, acquiring a corresponding request result and returning the request result to the target page.
According to a second aspect of the present invention, there is provided a page processing apparatus, comprising:
The request intercepting unit is used for intercepting a page request triggered by a target page; the target page is a webpage embedded in a corresponding target native application;
The plug-in acquisition unit is used for converting the page request into an object request and acquiring a target plug-in for responding to the object request;
and the request response unit is used for calling the target plug-in to respond to the object request, acquiring a corresponding request result and returning the request result to the target page.
According to a third aspect of the present invention, there is provided an electronic apparatus, comprising:
A memory for storing executable instructions;
And the processor is used for operating the electronic equipment to execute the page processing method according to the control of the executable instruction.
according to one embodiment of the invention, by intercepting a page request triggered by an operation requirement on a webpage embedded in a native application, converting the page request into an object request, acquiring a corresponding plug-in to respond to the object request, obtaining a corresponding request result and returning the corresponding request result to the webpage, realizing each function for responding to different page requests by the plug-in respectively, the same page request for different web pages, or different page requests for the same web page, may be responded to by invoking a plug-in, the code is modularized by a plug-in with finer granularity, the architecture level is simplified, the corresponding interception code does not need to be repeatedly developed aiming at each possible operation requirement of each webpage, the code redundancy is greatly reduced, moreover, the plug-ins are isolated from each other, and the modification or test of a single plug-in cannot influence other plug-ins, so that the operation stability is greatly improved, and the maintenance cost is reduced.
other features of the present invention and advantages thereof will become apparent from the following detailed description of exemplary embodiments thereof, which proceeds with reference to the accompanying drawings.
drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description, serve to explain the principles of the invention.
Fig. 1 is a block diagram showing an example of a hardware configuration of an electronic apparatus 1000 that can be used to implement an embodiment of the present invention.
FIG. 2 shows a flow diagram of a page processing method of an embodiment of the invention.
FIG. 3 shows a schematic diagram of an example of plug-in hub initialization of an embodiment of the present invention.
FIG. 4 shows a schematic diagram of an example of a plug-in center architecture of an embodiment of the invention.
Fig. 5 is a schematic diagram showing an example of a page processing method of the embodiment of the present invention.
fig. 6 shows a block diagram of the page processing apparatus 3000 of the embodiment of the present invention.
Fig. 7 shows a block diagram of an electronic device 4000 of an embodiment of the invention.
Detailed Description
various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
In all examples shown and discussed herein, any particular value should be construed as merely illustrative, and not limiting. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
< hardware configuration >
fig. 1 is a block diagram showing a hardware configuration of an electronic apparatus 1000 that can implement an embodiment of the present invention.
The electronic device 1000 may be a laptop, desktop, cell phone, tablet, etc. As shown in fig. 1, the electronic device 1000 may include a processor 1100, a memory 1200, an interface device 1300, a communication device 1400, a display device 1500, an input device 1600, a speaker 1700, a microphone 1800, and the like. The processor 1100 may be a central processing unit CPU, a microprocessor MCU, or the like. The memory 1200 includes, for example, a ROM (read only memory), a RAM (random access memory), a nonvolatile memory such as a hard disk, and the like. The interface device 1300 includes, for example, a USB interface, a headphone interface, and the like. The communication device 1400 is capable of wired or wireless communication, for example, and may specifically include Wifi communication, bluetooth communication, 2G/3G/4G/5G communication, and the like. The display device 1500 is, for example, a liquid crystal display panel, a touch panel, or the like. The input device 1600 may include, for example, a touch screen, a keyboard, a somatosensory input, and the like. A user can input/output voice information through the speaker 1700 and the microphone 1800.
The electronic device shown in fig. 1 is merely illustrative and is in no way meant to limit the invention, its application, or uses. In an embodiment of the present invention, the memory 1200 of the electronic device 1000 is configured to store instructions, and the instructions are configured to control the processor 1100 to operate to execute any one of the page processing methods provided in the embodiment of the present invention. It will be appreciated by those skilled in the art that although a plurality of means are shown for the electronic device 1000 in fig. 1, the present invention may relate to only some of the means therein, e.g. the electronic device 1000 relates to only the processor 1100 and the storage means 1200. The skilled person can design the instructions according to the disclosed solution. How the instructions control the operation of the processor is well known in the art and will not be described in detail herein.
< example >
In this embodiment, a new technical solution for processing a page is provided, where a page request triggered by an operation requirement on a web page embedded in a native application is intercepted, the page request is converted into an object request, a corresponding plug-in is obtained to respond to the object request, a corresponding request result is obtained and returned to the web page, functions for responding to different page requests are respectively implemented by the plug-ins, and for the same page request of different web pages or different page requests of the same web page, a plug-in response is called to modularize a code with a finer granularity, thereby simplifying an architecture level, without repeatedly developing a corresponding intercepted code for each possible operation requirement of each web page, greatly reducing a code redundancy amount, and the plug-ins are isolated from each other, so that modification or testing of a single plug-in does not affect other plug-ins, and greatly improving operation stability, and the maintenance cost is reduced.
< method >
In this embodiment, a page processing method is provided, as shown in fig. 2, and includes: step 2100-.
Step 2100, intercept a page request triggered by a target page.
In the present embodiment, the target page is a Web page (Web page) embedded in the corresponding target native application. A native application is an application program that can be directly run by a corresponding operating system and that can directly invoke hardware functions (e.g., camera, speaker, sensor, etc.) of an electronic device that hosts the operating system. The target native application is the native application currently being run.
The target page is used as a webpage embedded with the target native application to replace a native application page of the native application, and when receiving user operation or internally triggered operation requirements which can occur on the native application page, a corresponding page request can be triggered. User actions may include, for example, adding a menu, deleting a menu, social sharing, order payment, picture upload, and so forth.
in one example, the page request is a URL link with agreed scheme and host values.
The URL link having a Scheme value and a host value is a URL Scheme protocol, which is a protocol for page hopping within an Application (APP). In this example, the agreed scheme value and host value may be set according to a specific application scenario or application requirement. For example, in APP with name XX, a scheme value may be set as APP name, a host value is a fixed field value jsBridge, and the corresponding URL links are: XXscheme://jsBridgehost
When a target page receives user operation (for example, sharing request operation triggered by a sharing button implemented on the target page), a corresponding page request is triggered in response to the user operation, the page request has a URL link with an agreed scheme value and a host value, the page request to be intercepted can be quickly determined by identifying the URL link with the agreed scheme value and the host value, and the processing efficiency is improved.
In the embodiment, intercepting the page request can prevent the page jump, and avoids the exception caused by the fact that the page request related to the original page is triggered by user operation and the jump is directly triggered on the webpage.
Step 2200 converts the page request into an object request, and obtains a target plug-in for responding to the object request.
the page request comes from a webpage embedded with a native application, the page request is converted into an object request, a corresponding plug-in can be called according to the object request to respond to the object request, and the page request can be processed through the plug-in.
in this embodiment, all the pages in the form of web pages embedded in one or more native applications may be analyzed, the operation requirements related to the pages and requiring native application processing are extracted, a plug-in is constructed for each operation requirement, and a method of responding to a page request triggered by a page corresponding to the operation requirement is implemented. The method for responding to different page requests is realized through the plug-in respectively, and the page can be responded by calling the plug-in for the same page request of different webpages or different page requests of the same webpage. And each plug-in is isolated and independent from each other, and the addition, deletion, modification or test of the plug-in does not influence other plug-ins.
In one example, converting a page request into an object request, and obtaining a target plug-in for the object request may include: step 2210-2220.
Step 2210, the page request is parsed and converted into an object request of a preset request type.
in this example, at least the corresponding function name, which is the name of the function for responding to the page request corresponding to the object request, is included in the object request.
The preset request type is a specific type of the object request, and can be set according to a specific application scene or application requirements. For example, the object request may be an mbkwsrequest type request, and the specific mbkwsrequest type request may include a function name, and may further include a parameter index of a callback function corresponding to the method and a parameter related to the method, as shown in table 1 below.
TABLE 1 object request MBKWebRequest
The function name may be a name of a function that has been defined in advance and responds to a page request. The callback is a parameter index of a callback function agreed or agreed between the webpage end and the native application, and different parameter indexes correspond to different callback functions. The data is a functional parameter, the content corresponds to a specific function, for example, when the function is payment, the functional parameter includes a payment mode, a payment amount, a payment object and the like; when the function is sharing, the function parameters comprise a sharing mode, a sharing channel, sharing content and the like; the data can adopt a coded Json format, and the transmission efficiency is improved by utilizing the advantages of the Json format, such as light weight and the like.
Step 2220, according to the function name in the object request, detecting the registered plug-in through the plug-in center, and determining the plug-in corresponding to the function name in the object request as the target plug-in.
In this example, the plug-in center may be provided in the target native application, and maintain the correspondence between the registered plug-ins and the function names implemented by the plug-ins. By the aid of the central management device of the plug-in center, the registered plug-ins can be quickly detected according to the corresponding relation between the registered plug-ins and the function names realized by the plug-ins, the plug-ins corresponding to the function names in the object request can be found and serve as target plug-ins, and processing efficiency is improved.
in a more specific example, the method provided in this embodiment further includes:
And after the target native application is started, initializing the plug-in center as a global unique object, and registering all the plug-ins to the plug-in center according to corresponding function names.
In this example, the function name to which each plug-in uniquely corresponds is the name of the plug-in implementing the function.
For example, as shown in fig. 3, a web page embedded by a target native application may trigger a plurality of page requests such as a share request, a payment request, a menu operation request, and the like; the functions responding to different page requests comprise share, payment pay, menu operation menu and the like, and the plug-ins for realizing the functions comprise share plug-ins MBKWebSharePlugin, payment plug-ins MBKWebPayPlugin, menu operation plug-ins MBKWebMenu Plugin and the like; after the target native application starts, a globally unique singleton object, plug-in center MBKPluginManager, is initialized in the application: di FinishLaunchingWithOptions: method, and the registration of all plug-ins is completed in this occasion.
After the target native application is started, the plug-in center is initialized, and all plug-ins are registered in the plug-in center, so that the plug-in center can effectively aim at the object request converted by the page request after the target native application is started, and the calling service of the plug-ins is improved.
in another more specific example, the method provided in this embodiment further includes:
And respectively constructing plug-ins uniquely corresponding to different function names, and registering the plug-ins to the plug-in center.
In this example, the function name to which each plug-in uniquely corresponds is the name of the plug-in implementing the function.
For example, as shown in fig. 4, a web page embedded by a target native application may trigger a plurality of page requests such as a share request, a payment request, a menu operation request, a bluetooth unlock request, a login request, a page opening request, and the like; the functions of responding to different page requests comprise share, payment, menu operation menu, Bluetooth unlocking, bloothUnlock, login, page opening and the like; aiming at different functions, corresponding plug-ins are respectively constructed and comprise a sharing plug-in MBKWebSharePlugin, a payment plug-in MBKWebPayPlugin, a menu operation plug-in MBKWebMenuPlugin, a Bluetooth unlocking plug-in MBKWebBlothUnlockPlugin, a login plug-in MBKWebLoginPlugin and an opening page plug-in MBKWebOpenPagePlugin; each plug-in has corresponding receiving parameter (input parameter) MBKWebrequest and return parameter (output parameter) MBKWebResponse, and the receiving parameter comprises the function name realized by the plug-in and the function parameter related to the callback function; the return parameters comprise a response result error code, a response result error message and response result content after the plug-in is called to respond to the request; the constructed plug-ins are registered in a plug-in center, and the plug-in center can maintain the corresponding relation between the plug-ins and the function names realized by the plug-ins and manage the registered plug-ins.
By constructing plug-ins respectively corresponding to different functions and registering the plug-ins in the plug-in center, the corresponding relation between the plug-ins and the function names can be maintained by the plug-in center, the registered plug-ins are managed, the plug-ins can be conveniently and quickly inquired and called through the plug-in center, and the processing efficiency is improved.
After acquiring the target plug-in, entering:
Step 2300, calling the target plug-in to respond to the object request, obtaining the corresponding request result and returning the request result to the target page.
the object request is responded by calling the target plug-in, the page request can be processed through the plug-in, the corresponding request result is returned, the same page request of different webpages or different page requests of the same webpage can be responded by calling the plug-in, the code is modularized by the plug-in with finer granularity, the architecture level is simplified, the corresponding interception code does not need to be repeatedly developed aiming at each possible operation requirement of each webpage, the code redundancy is greatly reduced, the plug-ins are mutually isolated, the modification or the test of the single plug-in does not influence other plug-ins, the operation stability is greatly improved, and the maintenance cost is reduced.
In one example, invoking the target plug-in to respond to the object request, obtaining a corresponding request result, and returning the request result to the target page may include: step 2310-.
Step 2310, the target plugin is called to respond to the object request, and a corresponding object response is obtained.
The target plug-in implements the functionality to respond to the object request. The object request can be responded by calling the target plug-in, and the corresponding object response is obtained.
The object request can be used as an input parameter or a receiving parameter of the target plug-in, the target plug-in is triggered to be called to respond to the object request, and a corresponding return parameter or an output parameter is returned to serve as an object response.
For example, the object request may be an object request mbkwsrequest as shown in table 1 above, and the corresponding object response mbkwerresponse may be in the form shown in table 2 below.
TABLE 2 object response MBKWebResponse
Parameter name Necessity of Type (B) of significance
code Must choose Integer number of Responding to error codes
msg Must choose Character string responding to error messages
data Optionally Character string Responding to the result content
The response error code is a response result indication after the calling plug-in responds to the object request, wherein 0 may be used to indicate that the response is successful, and other integers respectively represent different types of response errors. msg is a response error message, with different specific error contents for response errors indicated by different response error codes. The data is response result content, and the content corresponds to a specific function, for example, when the function is payment, the response result content comprises a paid payment mode, a paid amount, a payment object and the like; when the function is sharing, the response result content comprises a shared sharing mode, a sharing channel, shared content and the like; the data can be a coded Json object, and the transmission efficiency is improved by using the advantages of the Json format such as light weight and the like.
In a more specific example, invoking the target plug-in to respond to the object request and obtain the corresponding object response may include: step 2311-2312.
step 2311, a target plug-in object corresponding to the target plug-in is created and returned to the webpage view of the target native application, and the webpage view is triggered to call the function corresponding to the target plug-in.
in this example, a web view (WebView) is a component provided in a target native application for exposing a web page. When a target plug-in capable of responding to an object request converted by a page request is acquired, a corresponding plug-in object can be created to trigger the calling of a function corresponding to the target plug-in through a webpage view, so that the calling of the target plug-in is realized, and the corresponding object request is responded.
Step 2312, an object response of a preset response type is received through a callback function of a function corresponding to the target plug-in.
the preset response type may be set according to a specific application scenario or application requirements, and may be mbkbWebResponse as shown in table 2 above, for example.
The target plug-in implements the corresponding functionality for responding to page requests. The object response returned by the function corresponding to the webpage view calling target plug-in is received through the callback function of the function corresponding to the target plug-in, the response process of the object request is completed, the calling of the target plug-in is realized through the independent and existing component in the native application of the webpage view, the object request converted by the page request is responded, and the processing efficiency can be improved.
Step 2320, the object response is converted into a request result in a preset result form according to the object request, and the request result is returned to the target page.
In this example, the preset result form may be set according to a specific application scenario or application requirement. For example, assume that the object request uses the mbkbwebrequest in table 1, and the specific content is mbkbwebrequest { name: 'share'; a callback: 1; data: { 'msg': 'hello' }; the object response adopts MBKWebResponse in the table 2, and the specific content is MBKWebResponse { code: 0; msg: ''; data: { } }; the preset result form can be js form, and the index is indexed according to the callback function of callback in the object request: 1, it can determine that the corresponding callback function is window.xxcallback [1], and according to the callback in the object request, the object can respond to the request result in the form of js character string:
window.XXXCallback[1]({code:0;msg:‘’;data:{}})。
the corresponding object response is converted into the request result in the preset result form and returned to the target page according to the object request, and the corresponding request result can be returned to the target page based on the preset result form, so that the target page can effectively identify the request result corresponding to the page request, a normal business process is continued according to the request result, and the process after the page request is intercepted is ensured to be normally processed.
In practical application, after converting a page request into an object request, a target plug-in corresponding to the object request may not be obtained due to plug-in not being constructed and plug-in not being registered, and correspondingly, the method provided in this embodiment further includes:
step 2400, when the target plug-in is not obtained, creating an object response in a default response form, converting the object request into a request result in a preset result form according to the object response, and returning to the target page.
The object response in the default response form is the default object response when the target plug-in cannot be acquired and the object request cannot be responded by calling the target plug-in. The default response form and the preset result form can be set according to a specific application scene or application requirements. For example, the object request uses the mbkwsrequest in table 1, the object response uses the mbkwsresponse in table 2, and the object response may directly construct the mbkwsresponse in which the return error Code is a special value and the corresponding return error message indicates that the target plug-in does not exist, and then, according to the mbkwsrequest and the mbkwsresponse, as exemplified in step S2320 above, the object response may be converted into a request result in the form of a js string according to the callback in the object request.
When the target plug-in cannot be obtained, an object response in a default response form is created, and the object response is converted into a corresponding request result and returned to the target page.
< example >
The page processing method provided in this embodiment will be further illustrated with reference to fig. 5.
In this example, the application name of the target native application is XX, and the target page is a web page embedded in the target native application. The page request is a share request triggered by the user clicking a share button on the target page. The target native application comprises a plug-in center and a webpage view. The plug-in center is used for managing various plug-ins registered thereon for responding to page requests, and comprises sharing plug-ins. The web page view is used to show web pages embedded in native applications.
As shown in fig. 5, the page processing method includes: step 201-.
In step 201, a web page receives a sharing request operation triggered by a user clicking a sharing button of a target page.
step 202, the webpage side encapsulates the sharing request operation into a URL link with an agreed scheme value and a host value to serve as a page request.
In this example, the URL link may be of the form:
XX://jsBridge?
name=share%callback=1&data=%7B%22msg%22%3A%22hello%22%7D
And step 203, the webpage requests to carry out page jump according to the page request.
Step 204, the webpage view intercepts the page request and informs the system to stop the page jump.
In this example, the corresponding page request may be intercepted by identifying a XX:// jsBridge type URL link.
Step 205, converting the page request into an object request with a preset request type.
In this example, the object request may be the mbkbwebrequest in table 1, and the specific content is the mbkbwebrequest { name: 'share'; a callback: 1; data: { 'msg': 'hello' }.
Step 206, the webpage view triggers the plug-in center to detect whether a target plug-in responding to the corresponding object request exists according to the object request.
Step 207, the plug-in center detects whether a corresponding target plug-in exists according to the function name included in the object request, if the target plug-in exists, the plug-in center creates a target plug-in object corresponding to the target plug-in and returns the target plug-in object to the webpage view, otherwise, the plug-in center returns Null to the webpage view.
And step 208, determining whether the target plug-in exists or not by the webpage view according to a result returned by the plug-in center, and if so, entering step 209, and if not, entering step 211.
Step 209, the web page view calls the function of the target plug-in through the target plug-in object.
In this example, the function of calling the target plug-in may be implemented by calling the handlejsbridge widget targeturl jsbridgelequest completion method of the plug-in, using the object request as an input parameter.
And step 210, receiving the returned object response with the preset response type through the callback function of the target plug-in.
In this example, an object response may be received through the callback function in the completion method, where the object response may be mbkbwebresponse in table 2, and the specific content is mbkbwebresponse { code: 0; msg: ''; data: {}}.
In step 211, an object response in the form of a default response is created.
In this example, the object response is the mbkbwebresponse in table 2, and the object response in the form of the default response may be the mbkbwebresponse in which the return error code is a special value, the corresponding return error message indicates that the target plug-in does not exist, and the data is empty.
Step 212, according to the object request, converting the object response into a request result in a preset result form and returning the request result to the target page.
In this example, the preset result form may be js form, and according to the callback function index, namely callback, in the object request: 1, it can determine that the corresponding callback function is window.xxcallback [1], and according to the callback in the object request, the object can respond to the request result in the form of js character string:
window.XXXCallback[1]({code:0;msg:‘’;data:{}})。
in step 213, the web page receives the request result, and executes a corresponding operation according to the request result.
The webpage end can determine whether the calling plug-in responds to the page request successfully according to the request result so as to execute the subsequent business process.
In step 214, the sharing operation is finished.
the above has described, with reference to the example, a flow of responding to a sharing operation request triggered in a web page of a target native application by calling a corresponding plug-in. The functions for responding to different page requests are respectively realized through the plug-ins, the same page requests of different webpages or different page requests of the same webpage can be responded by calling the plug-ins, the code is modularized by the plug-ins with finer granularity, the architecture level is simplified, the corresponding interception code does not need to be repeatedly developed aiming at each possible operation requirement of each webpage, the code redundancy is greatly reduced, the plug-ins are mutually isolated, other plug-ins cannot be influenced by the modification or test of a single plug-in, the operation stability is greatly improved, and the maintenance cost is reduced.
< Page processing apparatus >
in this embodiment, there is also provided a page processing apparatus 3000, as shown in fig. 6, including: the request intercepting unit 3100, the plug-in obtaining unit 3200, and the request responding unit 3300 are configured to implement the page processing method provided in this embodiment, and are not described herein again.
A request intercepting unit 3100, configured to intercept a page request triggered by a target page; the target page is a web page embedded in a corresponding target native application.
The page request is a URL link with a contracted scheme value and a host value.
The plug-in obtaining unit 3200 is configured to convert the page request into an object request, and obtain a target plug-in for responding to the object request.
Optionally, the plug-in obtaining unit 3200 is further configured to:
Analyzing the page request, and converting the page request into the object request with a preset request type; the object request at least comprises a corresponding function name;
detecting a registered plug-in through a plug-in center according to the function name in the object request, and determining the plug-in corresponding to the function name in the object request as the target plug-in; the plug-in center maintains the corresponding relation between the registered plug-ins and the function names realized by the plug-ins.
Optionally, the page processing apparatus 3000 is further configured to:
After the target native application is started, initializing the plug-in center as a global unique object, and registering all the plug-ins to the plug-in center according to corresponding function names; and the unique corresponding function name of each plug-in is the name of the function realized by the plug-in.
Optionally, the page processing apparatus 3000 is further configured to:
the plug-ins uniquely corresponding to different function names are constructed and registered in the plug-in center; and the unique corresponding function name of each plug-in is the name of the function realized by the plug-in.
A request responding unit 3300, configured to invoke the target plug-in to respond to the object request, obtain a corresponding request result, and return the request result to the target page.
Optionally, the request response unit 3300 is further configured to:
A device for calling the target plug-in to respond to the object request and acquiring a corresponding object response;
And the device is used for converting the object response into a request result in a preset result form according to the object request and returning the request result to the target page.
Optionally, the apparatus for invoking the target plug-in to respond to the object request and obtain a corresponding object response is further configured to:
Creating a target plug-in object corresponding to the target plug-in, returning to the webpage view of the target native application, and triggering the webpage view to call a function corresponding to the target plug-in;
And receiving the object response of a preset response type through a callback function of a function corresponding to the target plug-in.
Optionally, the page processing apparatus 3000 is further configured to:
and when the target plug-in is not acquired, creating an object response in a default response form, converting the object request into a request result in a preset result form according to the object response, and returning to the target page.
It will be appreciated by those skilled in the art that the page processing apparatus 3000 can be implemented in various ways. For example, the page processing apparatus 3000 may be implemented by an instruction configuration processor. For example, the page processing apparatus 3000 may be implemented by storing instructions in a ROM and reading the instructions from the ROM into a programmable device when the device is started. For example, the page processing apparatus 3000 may be cured into a dedicated device (e.g., ASIC). The page processing apparatus 3000 may be divided into units independent of each other, or may be implemented by combining them together. The page processing apparatus 3000 may be implemented by one of the various implementations described above, or may be implemented by a combination of two or more of the various implementations described above.
In the present embodiment, the page processing apparatus 3000 may have various specific implementation forms, for example, the page processing apparatus 3000 may be a function module provided in a native application, or the page processing apparatus 3000 may be a software development kit (e.g., SDK) packaged to be called by a native application.
< electronic apparatus >
In this embodiment, an electronic apparatus 4000 is further provided, as shown in fig. 7, including:
a memory 4100 for storing executable instructions;
The processor 4200 is configured to execute the electronic device to perform the page processing method provided in this embodiment according to the control of the executable instructions.
In this embodiment, the electronic device may be a mobile terminal such as a mobile phone, a tablet computer, a palm computer, and a smart watch. For example, the electronic device may be a mobile phone installed with a native application implementing the above-described page processing method.
The electronic device may also have other means, for example, as shown in fig. 1, and may further include a display device or the like.
The page processing method, device and electronic device provided in this embodiment have been described above with reference to the accompanying drawings and examples, where a page request triggered by an operation requirement on a web page embedded in a native application is intercepted, the page request is converted into an object request, a corresponding plug-in is obtained to respond to the object request, a corresponding request result is obtained and returned to the web page, and each function for responding to different page requests is implemented by the plug-in, and for the same page request of different web pages or different page requests of the same web page, a plug-in response may be invoked to modularize a code with a plug-in of a finer granularity, thereby simplifying a framework hierarchy, eliminating the need to repeatedly develop a corresponding intercepted code for each possible operation requirement of each web page, greatly reducing the code redundancy, and the plug-ins are isolated from each other, and the modification or testing of a single plug-in does not affect other plug-ins, greatly improving the operation stability and reducing the maintenance cost.
It is well known to those skilled in the art that with the development of electronic information technology such as large scale integrated circuit technology and the trend of software hardware, it has been difficult to clearly divide the software and hardware boundaries of a computer system. As any of the operations may be implemented in software or hardware. Execution of any of the instructions may be performed by hardware, as well as by software. Whether a hardware implementation or a software implementation is employed for a certain machine function depends on non-technical factors such as price, speed, reliability, storage capacity, change period, and the like. Accordingly, it will be apparent to those skilled in the art of electronic information technology that a more direct and clear description of one embodiment is provided by describing the various operations within the embodiment. Knowing the operations to be performed, the skilled person can directly design the desired product based on considerations of said non-technical factors.
The present invention may be a system, method and/or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied therewith for causing a processor to implement various aspects of the present invention.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present invention may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, aspects of the present invention are implemented by personalizing an electronic circuit, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA), with state information of computer-readable program instructions, which can execute the computer-readable program instructions.
aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (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-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. It is well known to those skilled in the art that implementation by hardware, by software, and by a combination of software and hardware are equivalent.
having described embodiments of the present invention, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein. The scope of the invention is defined by the appended claims.

Claims (10)

1. A page processing method is characterized by comprising the following steps:
Intercepting a page request triggered by a target page; the target page is a webpage embedded in a corresponding target native application;
Converting the page request into an object request, and acquiring a target plug-in for responding to the object request;
And calling the target plug-in to respond to the object request, acquiring a corresponding request result and returning the request result to the target page.
2. The method of claim 1, wherein converting the page request into an object request, and obtaining a target plug-in for responding to the object request comprises:
Analyzing the page request, and converting the page request into the object request with a preset request type; the object request at least comprises a corresponding function name;
Detecting a registered plug-in through a plug-in center according to the function name in the object request, and determining the plug-in corresponding to the function name in the object request as the target plug-in; the plug-in center maintains the corresponding relation between the registered plug-ins and the function names realized by the plug-ins.
3. The method of claim 2, further comprising:
After the target native application is started, initializing the plug-in center as a global unique object, and registering all the plug-ins to the plug-in center according to corresponding function names; and the unique corresponding function name of each plug-in is the name of the function realized by the plug-in.
4. The method of claim 2, further comprising:
Respectively constructing the plug-ins uniquely corresponding to different function names, and registering the plug-ins to the plug-in center; and the unique corresponding function name of each plug-in is the name of the function realized by the plug-in.
5. The method of claim 1, wherein invoking the target plug-in to respond to the object request to obtain a corresponding request result and return the request result to the target page comprises:
calling the target plug-in to respond to the object request to obtain a corresponding object response;
and converting the object response into a request result in a preset result form according to the object request, and returning to the target page.
6. The method of claim 5, wherein invoking the target plug-in to respond to the object request to obtain a corresponding object response comprises:
Creating a target plug-in object corresponding to the target plug-in, returning to the webpage view of the target native application, and triggering the webpage view to call a function corresponding to the target plug-in;
And receiving the object response of a preset response type through a callback function of a function corresponding to the target plug-in.
7. The method of claim 1, further comprising:
and when the target plug-in is not acquired, creating an object response in a default response form, converting the object request into a request result in a preset result form according to the object response, and returning to the target page.
8. The method of claim 1,
The page request is a URL link with a contracted scheme value and a host value.
9. A page processing apparatus, characterized in that,
The request intercepting unit is used for intercepting a page request triggered by a target page; the target page is a webpage embedded in a corresponding target native application;
The plug-in acquisition unit is used for converting the page request into an object request and acquiring a target plug-in for responding to the object request;
and the request response unit is used for calling the target plug-in to respond to the object request, acquiring a corresponding request result and returning the request result to the target page.
10. An electronic device, comprising:
a memory for storing executable instructions;
a processor for operating the electronic device to perform the page processing method according to the claimed claims 1-8 according to the control of the executable instruction.
CN201910775631.3A 2019-08-21 2019-08-21 Page processing method and device and electronic equipment Withdrawn CN110580156A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910775631.3A CN110580156A (en) 2019-08-21 2019-08-21 Page processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910775631.3A CN110580156A (en) 2019-08-21 2019-08-21 Page processing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN110580156A true CN110580156A (en) 2019-12-17

Family

ID=68811893

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910775631.3A Withdrawn CN110580156A (en) 2019-08-21 2019-08-21 Page processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110580156A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112631701A (en) * 2020-12-22 2021-04-09 平安普惠企业管理有限公司 Page request method and device, computer equipment and storage medium
CN113065079A (en) * 2021-04-13 2021-07-02 开鑫金服(南京)信息服务有限公司 Method, equipment and storage medium for calling native page based on address protocol

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015058716A1 (en) * 2013-10-25 2015-04-30 北京奇虎科技有限公司 Method for loading plug-in, browser and server
CN105260206A (en) * 2015-10-10 2016-01-20 北京京东尚科信息技术有限公司 Data source plug-in implementation method and server
CN107273127A (en) * 2017-06-15 2017-10-20 浪潮软件集团有限公司 Method and device for realizing page plug-in web application

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015058716A1 (en) * 2013-10-25 2015-04-30 北京奇虎科技有限公司 Method for loading plug-in, browser and server
CN105260206A (en) * 2015-10-10 2016-01-20 北京京东尚科信息技术有限公司 Data source plug-in implementation method and server
CN107273127A (en) * 2017-06-15 2017-10-20 浪潮软件集团有限公司 Method and device for realizing page plug-in web application

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112631701A (en) * 2020-12-22 2021-04-09 平安普惠企业管理有限公司 Page request method and device, computer equipment and storage medium
CN113065079A (en) * 2021-04-13 2021-07-02 开鑫金服(南京)信息服务有限公司 Method, equipment and storage medium for calling native page based on address protocol
CN113065079B (en) * 2021-04-13 2023-10-13 开鑫金服(南京)信息服务有限公司 Method, equipment and storage medium for realizing calling of native page based on address protocol

Similar Documents

Publication Publication Date Title
KR102179149B1 (en) Page component dynamic layout
US10169034B2 (en) Verification of backward compatibility of software components
US11269659B2 (en) Network address management systems and methods
WO2018196808A1 (en) Service processing method and device
US9811679B2 (en) Electronic system with access management mechanism and method of operation thereof
CN108762956B (en) Method for acquiring Native local data, server, mobile terminal and storage medium
CN109684008A (en) Card rendering method, device, terminal and computer readable storage medium
US11616860B2 (en) Information display method, terminal, and server
CN110580156A (en) Page processing method and device and electronic equipment
CN102937963A (en) Template and server content download using protocol handlers
CN114995859A (en) Page hot updating method, device, equipment and storage medium
CN112214250A (en) Application program assembly loading method and device
KR20130014203A (en) Multi operating system flatform in smart devices
US20130151945A1 (en) Processing Published and Subscribed Events
CN107918552B (en) Light application calling method and device, client device and electronic equipment
US8615744B2 (en) Methods and system for managing assets in programming code translation
CN112148596B (en) Method and device for generating error reporting content of deep learning framework
CN112395138B (en) Method and device for checking parameters
CN114115855A (en) Code multiplexing method and device, computer readable storage medium and electronic equipment
KR20130103239A (en) Method, server and terminal for providing web browsing service having translation
EP3872630A2 (en) Request processing method and apparatus, electronic device, and computer storage medium
CN113296978A (en) Content copying method, device, equipment and computer readable medium
CN118051221A (en) Program generation method and related equipment
CN115509543A (en) Method and device for determining document validity, electronic equipment and storage medium
CN113760586A (en) Picture detection method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20201211

Address after: Room 168, building 6, 741 Hangzhou Road, Yangpu District, Shanghai 200090

Applicant after: HANHAI INFORMATION TECHNOLOGY SHANGHAI Co.,Ltd.

Address before: Room Bnan 1231, 2 bungalows, No. 5 Road, College, Haidian District, Beijing, 100191

Applicant before: BEIJING MOBIKE TECHNOLOGY Co.,Ltd.

WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20191217