Disclosure of Invention
In view of the above, the present invention has been made to provide a data processing method, system and mobile device for a hybrid application that overcome or at least partially solve the above-mentioned problems.
In order to achieve the purpose, the invention provides the following technical scheme:
a data processing method of a hybrid application program is applied to a mobile device, and the method comprises the following steps:
acquiring a first uniform resource locator of a webpage to be loaded;
adding the unique identifier of the mobile equipment into the first uniform resource locator to obtain a second uniform resource locator;
loading a web page based on the second uniform resource locator;
and acquiring and analyzing the second uniform resource locator in the loaded webpage to obtain the unique identifier of the mobile equipment, and assigning the user identifier in the Cookie file corresponding to the webpage as the unique identifier of the mobile equipment.
In the above method, preferably, the adding the unique identifier of the mobile device into the first uniform resource locator to obtain a second uniform resource locator includes:
analyzing the first uniform resource locator, and determining the position of the parameter carried by the first uniform resource locator in the first uniform resource locator;
adding a preset parameter after the last parameter of the parameter carried by the first uniform resource locator to obtain a second uniform resource locator; the value of the preset parameter is the unique identifier of the mobile device.
In the above method, preferably, the adding the unique identifier of the mobile device into the first uniform resource locator to obtain a second uniform resource locator includes:
analyzing the first uniform resource locator, and determining the position of the parameter carried by the first uniform resource locator in the first uniform resource locator;
adding a preset parameter before a first parameter of the parameter carried by the first uniform resource locator to obtain a second uniform resource locator; the value of the preset parameter is the unique identifier of the mobile device.
Preferably, in the method, after assigning the user identifier in the Cookie file corresponding to the web page as the unique identifier of the mobile device, the method further includes:
receiving a first webpage data request generated by user triggering;
adding the value of the user identifier in the Cookie file into the first webpage data request to obtain a second webpage data request;
and sending the second webpage data request to a network server.
A data processing system for a hybrid application for use with a mobile device, the system comprising:
the processing module is used for acquiring a first uniform resource locator of a webpage to be loaded; adding the unique identifier of the mobile equipment into the first uniform resource locator to obtain a second uniform resource locator;
a loading module for loading a web page based on the second uniform resource locator;
and the analysis module is used for acquiring and analyzing the second uniform resource locator in the loaded webpage to obtain the unique identifier of the mobile equipment, and assigning the user identifier in the Cookie file corresponding to the webpage as the unique identifier of the mobile equipment.
In the above system, preferably, the adding, by the processing module, the unique identifier of the mobile device into the first uniform resource locator to obtain a second uniform resource locator includes:
the processing module analyzes the first uniform resource locator and determines the position of the parameter carried by the first uniform resource locator in the first uniform resource locator; adding a preset parameter after the last parameter of the parameter carried by the first uniform resource locator to obtain a second uniform resource locator; the value of the preset parameter is the unique identifier of the mobile device.
In the above system, preferably, the adding, by the processing module, the unique identifier of the mobile device into the first uniform resource locator to obtain a second uniform resource locator includes:
the processing module analyzes the first uniform resource locator and determines the position of the parameter carried by the first uniform resource locator in the first uniform resource locator; adding a preset parameter before a first parameter of the parameter carried by the first uniform resource locator to obtain a second uniform resource locator; the value of the preset parameter is the unique identifier of the mobile device.
Preferably, in the system, the loading module is further configured to receive a first webpage data request generated by user triggering, and send a second webpage data request to the network server;
the analysis module is further configured to add the value of the user identifier in the Cookie file to the first webpage data request to obtain the second webpage data request.
A mobile device comprising a data processing system for a hybrid application as claimed in any preceding claim.
By means of the technical scheme, the unique identifier of the mobile device is added into the uniform resource locator of the webpage to be loaded before the embedded browser loads the webpage, after the embedded browser loads the webpage, the uniform resource locator is obtained from the loaded webpage and the unique identifier of the mobile device is analyzed, the user identifier in the Cookie file corresponding to the loaded webpage is assigned as the unique identifier of the mobile device, the embedded browser sends network data by taking the unique identifier of the mobile device as the user identifier, and the APP data in the hybrid APP are communicated with the webpage data. According to the method, the browser loading function provided by the mobile equipment system is directly used, and the browser loading function provided by the mobile equipment system does not need to be modified, so that the development cost of the hybrid APP is reduced, and the developed hybrid APP code is easy to deploy.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The data processing method and the system for the hybrid application program provided by the embodiment of the invention can be configured on the mobile equipment side. The mobile device may install at least one hybrid application.
Referring to fig. 1, fig. 1 is a flowchart illustrating an implementation of a data processing method for a hybrid application according to an embodiment of the present invention, which may include:
step S11: acquiring a first uniform resource locator of a webpage to be loaded;
in the process that a user operates the hybrid APP at the mobile device side, when a webpage needs to be loaded, the embedded browser is loaded by calling a loading function of the embedded browser, the embedded browser sends a webpage data request to the network server, and the network server returns a Uniform Resource Locator (URL) corresponding to the webpage data request.
The first uniform resource locator of the webpage to be loaded refers to a uniform resource locator returned by the network server after the embedded browser sends the webpage data request to the network server.
Step S12: adding the unique identifier of the mobile equipment into the first uniform resource locator to obtain a second uniform resource locator;
the unique identifier of the mobile device may be an International Mobile Equipment Identity (IMEI), or may be other device identifiers that can uniquely identify the mobile device, such as an identifier for advertisement (IDFA) of the mobile device. Among them, IMEI is common to Android system based mobile devices, while IDFA is common to iOS system based mobile devices. The unique identification of the mobile device may be read through a data interface provided by the mobile device.
The uniform resource locator is generally composed of a domain name and a parameter, wherein the domain name is used for indicating an address of a web page, and the parameter is associated with the content of the web page. In the embodiment of the invention, the unique identifier of the mobile equipment is added into the parameter part of the uniform resource locator. After adding the unique identifier of the mobile device into the first uniform resource locator, the uniform resource locator consists of three parts: a domain name, a first type parameter and a second type parameter; the domain name and the first type of parameters are data carried in a uniform resource locator returned by the network server and are used for loading a webpage, and the second type of parameters are unique identifiers of the mobile equipment and are used for getting through the data.
Step S13: loading the web page based on the second uniform resource locator;
in the embodiment of the invention, after the network server returns the uniform resource locator, the embedded browser loads the webpage based on the uniform resource locator added with the unique identifier of the mobile equipment instead of loading the webpage based on the uniform resource locator returned by the network server.
Step S14: and acquiring a second uniform resource locator in the loaded webpage, analyzing the acquired second uniform resource locator to obtain a unique identifier of the mobile equipment, and assigning the user identifier in the Cookie file corresponding to the loaded webpage as the unique identifier of the mobile equipment.
The user id in the Cookie file is data stored on the user's local terminal by the web site for user identification and session tracking, and is typically stored encrypted. According to the traditional method for establishing the Cookie file, after a browser loads a webpage, a tracker on the webpage randomly generates an identification code as a user identifier to be stored in the Cookie file on a local terminal of a user.
Different from the traditional way of establishing the Cookie file, in the embodiment of the invention, after the browser loads the webpage, the tracker on the webpage can store the unique identifier of the mobile device as the user identifier in the Cookie file.
And then, when webpage data is requested again, the user identification (namely the unique identification of the mobile equipment) in the Cookie file is sent to the network server through a webpage data request, so that the network server realizes user identity identification and session tracking according to the unique identification of the mobile equipment, and the user acquisition of the APP side of the hybrid APP is also based on the unique identification of the mobile equipment to acquire data, so that the association between the user operation data of the webpage side and the user operation data of the APP side is realized through the unique identification of the mobile equipment, and the operation data of the APP side and the operation data of the webpage side are communicated.
Based on the data processing method of the hybrid application program provided by the embodiment of the invention, only one processing module needs to be designed, the processing module adds the unique identifier of the mobile device into the URL of the page to be loaded, then the browser provided by the mobile device system is directly used for loading the web page, and then the unique identifier of the mobile device is analyzed from the URL in the loaded web page and written into the Cookie file, so that the operation data of the APP side and the operation data of the web page side can be communicated without modifying the browser loading function provided by the mobile device system, thereby avoiding errors caused by artificial factors in the modification process (for example, in the process of modifying the browser loading function, the parameters in the code of the modified browser loading function need to be noticed to be consistent with the parameters of the codes of other parts of the APP, and in the process of modifying, due to the artificial operation, modification of some parameters is inevitably omitted, so that functions of the APP cannot be realized) needs to be checked and modified again, so that the development period is long, and therefore, the data processing method of the hybrid application program provided by the embodiment of the invention reduces the development cost of the hybrid APP, and the design of the processing module can be obtained by modifying the processing module without the basis of the original browser loading function, but is independent of the code of the browser loading function, so that the developed hybrid APP code is easy to deploy.
In an alternative embodiment, one implementation manner of adding the unique identifier of the mobile device to the first uniform resource locator to obtain the second uniform resource locator may be:
analyzing the first uniform resource locator, and determining the position of the parameter carried by the first uniform resource locator in the first uniform resource locator;
adding a preset parameter after the last parameter of the parameter carried by the first uniform resource locator to obtain a second uniform resource locator; the value of the preset parameter is the unique identifier of the mobile equipment.
In the embodiment of the present invention, in order to not affect the structure of the original parameter, the preset parameter carrying the unique identifier of the mobile device is added to the last parameter of the parameter carried by the first uniform resource locator, that is, after the preset parameter is added to the first uniform resource locator, the original parameter in the second uniform resource locator is located between the domain name and the preset parameter.
In another alternative embodiment, one implementation manner of adding the unique identifier of the mobile device to the first uniform resource locator to obtain the second uniform resource locator may be:
analyzing the first uniform resource locator, and determining the position of the parameter carried by the first uniform resource locator in the first uniform resource locator;
adding a preset parameter before a first parameter of a parameter carried by the first uniform resource locator to obtain a second uniform resource locator; the value of the preset parameter is the unique identifier of the mobile equipment.
In order to not affect the structure of the original parameter, in the embodiment of the present invention, the preset parameter carrying the unique identifier of the mobile device is added before the first parameter of the parameter carried by the first uniform resource locator, that is, after the preset parameter is added to the first uniform resource locator, the preset parameter is located between the domain name in the second uniform resource locator and the original parameter.
After assigning the user identifier in the Cookie file corresponding to the loaded webpage to be the unique identifier of the mobile device, the data processing method for the hybrid application program provided by the embodiment of the present invention may further include:
receiving a first webpage data request generated by user triggering;
when the user requests the webpage data again in the process of operating the APP, the embedded browser generates a webpage data request again.
Adding the value of the user identifier in the Cookie file into the first webpage data request to obtain a second webpage data request;
typically, the inline browser generates the web page data request triggered on the basis of the web page that has been loaded, so the value of the user identification in the Cookie file (i.e., the unique identification of the mobile device) can be added to the first web page data request by the tracker on the loaded web page.
And sending a second webpage data request to the network server. And after receiving the second webpage data request, the network server performs user identification, session tracking, data acquisition and other operations according to the user identifier in the second webpage data request, namely the unique identifier of the mobile device.
Corresponding to the method embodiment, an embodiment of the present invention further provides a data processing system of a hybrid application program, and a schematic structural diagram of the data processing system of the hybrid application program provided in the embodiment of the present invention is shown in fig. 2, and may include:
a processing module 21, a loading module 22 and an analyzing module 23; wherein,
the processing module 21 is configured to obtain a first uniform resource locator of a webpage to be loaded; adding the unique identifier of the mobile equipment into the first uniform resource locator to obtain a second uniform resource locator;
the processing module 21 is a function that is independent of the browser loading function provided by the mobile device.
When a user needs to load a webpage in the process of operating the hybrid APP at the mobile equipment side, a webpage data request is sent to the network server through the loading module, and the network server returns a uniform resource locator corresponding to the webpage data request.
The first uniform resource locator of the web page to be loaded refers to a uniform resource locator returned by the network server after the loading module sends the web page data request to the network server.
The unique identifier of the mobile device may be an International Mobile Equipment Identity (IMEI), or may be other device identifiers that can uniquely identify the mobile device, such as an identifier for advertisement (IDFA) of the mobile device. Among them, IMEI is common to Android system based mobile devices, while IDFA is common to iOS system based mobile devices.
The uniform resource locator is generally composed of a domain name and a parameter, wherein the domain name is used for indicating an address of a web page, and the parameter is associated with the content of the web page. In the embodiment of the present invention, the processing module 21 adds the unique identifier of the mobile device to the parameter portion of the uniform resource locator. After adding the unique identifier of the mobile device into the first uniform resource locator, the uniform resource locator consists of three parts: a domain name, a first type parameter and a second type parameter; the domain name and the first type of parameters are data carried in a uniform resource locator returned by the network server and are used for loading a webpage, and the second type of parameters are unique identifiers of the mobile equipment and are used for getting through the data.
The loading module 22 is configured to load the web page based on the second uniform resource locator; the loading module 22 may be an embedded browser provided by the mobile device system.
In the embodiment of the invention, after the network server returns the uniform resource locator, the loading module loads the webpage based on the uniform resource locator added with the unique identifier of the mobile equipment instead of loading the webpage based on the uniform resource locator returned by the network server.
The parsing module 23 is configured to obtain the second uniform resource locator in the loaded web page, parse the obtained second uniform resource locator to obtain the unique identifier of the mobile device, and assign the user identifier in the Cookie file corresponding to the web page to the unique identifier of the mobile device.
The user id in the Cookie file is data stored on the user's local terminal by the web site for user identification and session tracking, and is typically stored encrypted. The traditional method for establishing the Cookie file is that after a browser loads a webpage, an identification code is randomly generated and stored in the Cookie file on a local terminal of a user as a user identifier.
Different from the traditional way of establishing the Cookie file, in the embodiment of the present invention, after the loading module 22 loads the web page, the unique identifier of the mobile device is stored in the Cookie file as the user identifier.
And then, when webpage data is requested again, the user identification (namely the unique identification of the mobile equipment) in the Cookie file is sent to the network server through a webpage data request, so that the network server realizes user identity identification and session tracking according to the unique identification of the mobile equipment, and the user acquisition of the APP side of the hybrid APP is also based on the unique identification of the mobile equipment to acquire data, so that the association between the user operation data of the webpage side and the user operation data of the APP side is realized through the unique identification of the mobile equipment, and the operation data of the APP side and the operation data of the webpage side are communicated.
In the foregoing embodiment, optionally, the processing module 21 adds the unique identifier of the mobile device to the first uniform resource locator to obtain a second uniform resource locator, which may specifically include:
the processing module 21 analyzes the first uniform resource locator, and determines the position of the parameter carried by the first uniform resource locator in the first uniform resource locator; adding a preset parameter after the last parameter of the parameter carried by the first uniform resource locator to obtain a second uniform resource locator; the value of the preset parameter is the unique identifier of the mobile equipment.
In the embodiment of the present invention, in order to not affect the structure of the original parameter, the preset parameter carrying the unique identifier of the mobile device is added to the last parameter of the parameter carried by the first uniform resource locator, that is, after the preset parameter is added to the first uniform resource locator, the original parameter in the second uniform resource locator is located between the domain name and the preset parameter.
In another optional embodiment, the processing module 21 adds the unique identifier of the mobile device to the first uniform resource locator to obtain a second uniform resource locator, which may specifically include:
the processing module 21 analyzes the first uniform resource locator, and determines the position of the parameter carried by the first uniform resource locator in the first uniform resource locator; adding a preset parameter before a first parameter of a parameter carried by the first uniform resource locator to obtain a second uniform resource locator; the value of the preset parameter is the unique identifier of the mobile equipment.
In order to not affect the structure of the original parameter, in the embodiment of the present invention, the preset parameter carrying the unique identifier of the mobile device is added before the first parameter of the parameter carried by the first uniform resource locator, that is, after the preset parameter is added to the first uniform resource locator, the preset parameter is located between the domain name in the second uniform resource locator and the original parameter.
In the above embodiment, optionally, the loading module 22 may be further configured to receive a first webpage data request generated by a user trigger, and send a second webpage data request to the web server;
the second webpage data request is obtained by processing the first webpage data request by the parsing module 23, and specifically, the parsing module 23 adds the value of the user identifier in the Cookie file to the first webpage data request to obtain the second webpage data request.
In the embodiment of the present invention, after the loading module 22 receives a first webpage data request generated by a user trigger, the parsing module 23 adds a value of a user identifier in a Cookie file to the first webpage data request to obtain a second webpage data request, and the loading module 22 sends the second webpage data request to the network server.
The data processing system of the hybrid application includes a processor and a memory, the processing module 21, the loading module 22, the parsing module 23, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the purpose of realizing the mixed type APP with easily deployed codes at low development cost is achieved by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
Based on the data processing system of the hybrid application provided by the embodiment of the invention, only one processing module needs to be designed, the processing module adds the unique identifier of the mobile device into the URL of the page to be loaded, then the browser provided by the mobile device system is directly used for loading the web page, and then the unique identifier of the mobile device is analyzed from the URL in the loaded web page and written into the Cookie, so that the operation data of the APP side and the operation data of the web page side can be communicated without modifying the browser loading function provided by the mobile device system, thereby avoiding errors caused by artificial factors in the modification process (for example, in the process of modifying the browser loading function, the parameters in the code of the modified browser loading function need to be noticed to be consistent with the parameters of the codes of other parts of the APP, and in the modification process, due to the artificial operation, modification of some parameters is inevitably omitted, so that functions of the APP cannot be realized) needs to be checked and modified again, and the development period of breakfast is long, so that the development cost of the hybrid APP is reduced by the data processing system of the hybrid application provided by the embodiment of the invention, and the developed hybrid APP code is easy to deploy because the processing module can be obtained by modifying the processing module without the original browser loading function and is independent of the code of the browser loading function.
Embodiments of the present invention further provide a mobile device, where the mobile device may install at least one hybrid application, where the application includes a data processing system of the hybrid application provided in any one of the above system embodiments.
The mobile device may be a mobile device based on an Andriod system, and may also be a mobile device based on an iOS system. The mobile device can be a mobile phone, a tablet computer, a palm computer and the like.
The present application further provides a computer program product adapted to perform program code for initializing the following method steps when executed on a data processing device:
acquiring a first uniform resource locator of a webpage to be loaded;
adding the unique identifier of the mobile equipment into the first uniform resource locator to obtain a second uniform resource locator;
loading the web page based on the second uniform resource locator;
and acquiring and analyzing the second uniform resource locator in the loaded webpage to obtain the unique identifier of the mobile equipment, and assigning the user identifier in the Cookie file corresponding to the loaded webpage as the unique identifier of the mobile equipment.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may 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, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, 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 specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.