Summary of the invention
In order to overcome the problems, such as that the above method exists, this application provides a kind of data transmission methods and device, terminal to set
Standby, storage medium, which passes through parsing web page source code and is embedded in the parameter for needing to transmit, to ensure to pass in data
The case where simultaneously malicious modification critical parameter information will not be kidnapped during defeated by third party, occurs, and substantially increases the primary page of terminal
The safety of data transmission between face and web page.
On the one hand, the embodiment of the present application provides a kind of data transmission method, comprising:
Terminal obtains web page source code;
Web page source code is converted to the first character string by the terminal;
The Parameter Switch of required transmitting is the second character string by the terminal;
Second character string is embedded in first character string by the terminal;
First character string for being embedded with the second character string is loaded as web page by the terminal.
Optionally, the method also includes: the web page after terminal parsing load obtains the parameter.
Optionally, the method also includes:
The web page source code is converted to the format of binary file by the terminal;
Web page binary system sound code file described in the terminal downloads;
The web page binary system source code file content is carried out unserializing using UTF8 coded format by the terminal,
The first character string after being converted.
Optionally, the method also includes: second character string is embedded into the first of the first character string by the terminal
In field, the second field is generated, first field is two adjacent scripted codes;The terminal is in first character string
The middle position for searching the first label, first label are header file identifications;Second field is embedded into institute by the terminal
After first label for stating the first character string.
On the other hand, the embodiment of the present application also provides a kind of data transmission device, comprising: module is obtained, for obtaining web
Page source code;First conversion module, for web page source code to be converted to the first character string;Second conversion module, for that will need
The Parameter Switch to be transmitted is the second character string;It is embedded in module, for second character string to be embedded in first character string
In;Loading module, for first character string for being embedded with the second character string to be loaded as web page.
Optionally, described device further include: the loading module is used to parse the web page after load, obtains institute
State parameter.
Optionally, described device further include: the web page source code is converted to binary system text by first conversion module
The format of part;First conversion module is for downloading the web page binary system sound code file;First conversion module is adopted
The web binary system source code file content is subjected to unserializing with UTF8 coded format, the first character string after being converted.
Optionally, described device further include: the insertion module is used to second character string being embedded into the first character
In first field of string, the second field is generated, first field is two adjacent scripted codes;The insertion module is used for
The position of the first label is searched in first character string, first label is header file identifications;The insertion module is used
After second field to be embedded into first label of first character string.
On the other hand, the embodiment of the present application also provides a kind of terminal devices, comprising: processor and is stored with calculating
The memory of machine instruction;The processor reads the computer instruction, and executes data transmission method as described above.
On the other hand, the embodiment of the present application also provides a kind of storage mediums, are stored with computer instruction, the computer
Instruction, which is performed, realizes data transmission method as described above.
Data processing method provided by the embodiments of the present application and data processing equipment pass through parsing web page source code and embedding
Enter the parameter for needing to transmit, to ensure that simultaneously malicious modification critical parameter information will not be kidnapped by third party in data transmission procedure
The case where occur, substantially increase between the primary page of terminal and web page data transmission safety.
Specific embodiment
Applicant, can be true by way of the study found that web page source code is parsed and is embedded in the parameter for needing to transmit
Guarantor will not be kidnapped by third party during carrying out data transmission between the primary page and web page and malicious modification key is joined
Number information.The specific embodiment of the application is described with reference to the accompanying drawing.
Referring to Fig. 1, one embodiment of the application provides a kind of data processing method, comprising: step 101 to 105.
Step 101: terminal obtains web page source code.
Step 102: web page source code is converted to the first character string by the terminal.
Fig. 2 is that web page source code is converted to the first character string by the terminal that one embodiment of the application provides
Flow chart, comprising: step 1021 to step 1024.
Step 1021: the source code of the web page is converted to the format of binary file by the terminal.
Step 1022: downloading web page binary system sound code file.
Step 1023: web binary system source code file content is subjected to unserializing using UTF8 coded format.
Step 1024: obtaining the first character string of string type.
Step 103: the Parameter Switch of required transmission is the second character string by the terminal.
In one embodiment of the application, in order to make the parameter correctly be embedded into web page binary source
In code, the parameter of required transmitting is switched to the second character string of string type.
Step 104: second character string is embedded in first character string by the terminal.
The second character string will appear incompatible situation in order to prevent during being embedded into the first character string, in the application
One be that Fig. 3 is that second character string is embedded in the flow chart in first character string by the terminal in embodiment, wrap
It includes: step 1041 to step 1043.
Step 1041: the second character string is added in the first field of the first character string.
In one embodiment of the application, first field can be "<script><script>", and the second character is serially added
Enter between two<script>of first field, obtaining the second field "<script>second character string<script>".
Step 1042: the position of the first label is searched in the first character string.
In one embodiment of the application, first label be "</head>".
Step 1043: after the second field to be embedded into first label of first character string.
In one embodiment of the application, can by the second field "<script>second character string</script>" be embedded into
"</head>" after label.
Step 105: first character string for being embedded with the second character string is loaded as web page by the terminal.
Data processing method provided by the embodiments of the present application, the parameter for passing through parsing web page source code and transmitting needs
It is embedded, avoids the parameter by appearance the case where third party's abduction or malicious modification critical parameter information, greatly improve
Data transmission security between the primary page of terminal and web page.
Fig. 4 is the interaction figure between the primary page and web page in one embodiment terminal of the application, in the embodiment
In, after the primary page is loaded, operation following steps include: step 401 to step 406.
Step 401: downloading the binary system source code of web page.
Step 402: web binary system source code file content being subjected to unserializing processing using UTF8 coded format, is obtained
First character string of string type.
Step 403: the second character string that the parameter transmitted will be needed to be converted into string type.
Step 404: finding the first field in the first character string, the second character string is embedded in the first field, forms second
Field.This process specifically may refer to Fig. 3, and details are not described herein again.
Step 405: being searched in the binary system source code of web page</head>the position of label.
Step 406: the second field is inserted into</head>after label.
In the embodiment of the present application, second field is<script>label for including parameter.
By loading web page, after generating web page, execute step 407: identification<script>label, acquisition are transmitted
Parameter.
Data processing method provided by the embodiments of the present application, the parameter for passing through parsing web page source code and transmitting needs
It is embedded in<script>label script file, avoids the parameter and kidnapped or malicious modification critical parameter information by third party
Situation occurs, and substantially increases the safety of the data transmission between the primary page of terminal and web page.
To ensure that the data transmission security between the primary page of terminal and web page, Fig. 5 provide for the embodiment of the present application
Data processing equipment structural schematic diagram.Since Installation practice is substantially similar to embodiment of the method, so describing to compare
Simply, the relevent part can refer to the partial explaination of embodiments of method.Installation practice described below is only schematical.
Referring to Fig. 5, this application provides a kind of data processing equipments, comprising:
Module 501 is obtained, for obtaining web page source code;
First conversion module 502, for web page source code to be converted to the first character string;
Second conversion module 503, the Parameter Switch for that will need to transmit are the second character string;
It is embedded in module 504, for second character string to be embedded in first character string;
Loading module 505, for first character string for being embedded with the second character string to be loaded as web page.
For the acquisition for guaranteeing web page source code, in one embodiment of the application, the loading module 505 is for solving
The web page after analysis load, the parameter transmitted needed for obtaining.
For the parameter is embedded into the web page source code, in one embodiment of the application, described first turn
Then mold changing block uses UTF8 coded format by the web binary source for downloading the web page binary system sound code file
Code file carries out unserializing, the first character string after being converted.
To enable to load out the effect after being embedded in the parameter in web page, in one embodiment of the application, institute
It states terminal second character string is embedded into the first field of the first character string, generates the second field, first field
For two adjacent scripted codes;The terminal searches the position of the first label, first mark in first character string
Label are header file identifications;Second field is embedded into after first label of first character string by the terminal.
Data processing equipment provided by the embodiments of the present application, the parameter for passing through parsing web page source code and transmitting needs
It is embedded, avoids the parameter by appearance the case where third party's abduction or malicious modification critical parameter information, greatly improve
Data transmission security between the primary page of terminal and web page.
Present invention also provides a kind of terminal devices, comprising: processor and the memory for being stored with computer instruction;
The processor reads the computer instruction, and executes data transmission method as described above.
Present invention also provides a kind of storage mediums, are stored with computer instruction, and the computer instruction is performed reality
Now data transmission method as described above.
It should be noted that if the data transmission device is realized in the form of SFU software functional unit and as independent
Product when selling or using, can store in a computer readable storage medium.Based on this understanding, the application is real
All or part of the process in existing above-described embodiment method, can also instruct relevant hardware come complete by computer program
At the computer program can be stored in a computer readable storage medium, which is being computer-executed
When, it can be achieved that the step of above-mentioned each embodiment of the method.Wherein, the computer program includes computer program code, described
Computer program code can be source code form, object identification code form, executable file or certain intermediate forms etc..The meter
Calculation machine readable medium may include: can carry the computer program code any entity or device, recording medium, USB flash disk,
Mobile hard disk, magnetic disk, CD, computer storage, read-only memory (ROM, Read-Only Memory), random access memory
Device (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It needs to illustrate
It is that the content that the computer-readable medium includes can be fitted according to the requirement made laws in jurisdiction with patent practice
When increase and decrease, such as in certain jurisdictions, according to legislation and patent practice, computer-readable medium does not include electric carrier wave letter
Number and telecommunication signal.
It should be noted that for the various method embodiments described above, describing for simplicity, therefore, it is stated as a series of
Combination of actions, but those skilled in the art should understand that, the application is not limited by the described action sequence because
According to the application, certain steps can use other sequences or carry out simultaneously.Secondly, those skilled in the art should also know
It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules might not all be this Shen
It please be necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment
Point, it may refer to the associated description of other embodiments.
The application preferred embodiment disclosed above is only intended to help to illustrate the application.There is no detailed for alternative embodiment
All details are described, also not limiting this application is only the specific embodiment.Obviously, according to the content of this specification,
It can make many modifications and variations.These embodiments are chosen and specifically described to this specification, is in order to preferably explain the application
Principle and practical application, so that skilled artisan be enable to better understand and utilize the application.The application is only
It is limited by claims and its full scope and equivalent.
The application preferred embodiment and embodiment are explained in detail above in conjunction with attached drawing, but applied simultaneously
The above-described embodiment and examples are not limited to, within the knowledge of those skilled in the art, can also not departed from
The application makes a variety of changes under the premise of conceiving.