CN107959727B - Method and device for communication between webpage and client - Google Patents

Method and device for communication between webpage and client Download PDF

Info

Publication number
CN107959727B
CN107959727B CN201711340001.0A CN201711340001A CN107959727B CN 107959727 B CN107959727 B CN 107959727B CN 201711340001 A CN201711340001 A CN 201711340001A CN 107959727 B CN107959727 B CN 107959727B
Authority
CN
China
Prior art keywords
service
client
processing request
service processing
data
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.)
Active
Application number
CN201711340001.0A
Other languages
Chinese (zh)
Other versions
CN107959727A (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201711340001.0A priority Critical patent/CN107959727B/en
Publication of CN107959727A publication Critical patent/CN107959727A/en
Application granted granted Critical
Publication of CN107959727B publication Critical patent/CN107959727B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Abstract

The invention provides a method and a device for communication between a webpage and a client, and relates to the technical field of networks. The invention realizes a local server through the appointed client, and can realize the business request and the business processing process through the interaction between the webpage and the local server in the business processing process.

Description

Method and device for communication between webpage and client
Technical Field
The present invention relates to the field of network technologies, and in particular, to a method and an apparatus for performing communication between a web page and a client.
Background
For some web page related services, it is usually required to rely on a browser client to perform the services, so once the browser client is closed, the services may be interrupted, and the service processing process may be seriously affected. Therefore, commands can be directly sent to the client through the webpage, the client can execute some high-authority commands, and the client can return the execution result to the webpage. However, as is well known, the authority of the Web (specifically, Web-related scripts and the like) is under strict authority control in the conventional case, and operations such as reading and writing of local files, starting of processes and the like cannot be performed. However, with the development of network technology, the demand for such service processing is increasing, and therefore, how to perform service processing through communication between a web page and a client on the premise of ensuring security is a technical problem that needs to be solved urgently.
Disclosure of Invention
The embodiment of the invention provides a method and a device for communication between a webpage and a client, which can realize the communication between the webpage and the client while ensuring the security, thereby processing various different services and greatly improving the service processing efficiency. The technical scheme is as follows:
in one aspect, a method for communication between a web page and a client is provided, and is applied to a specified client, where the specified client is initialized to be a server and configured with a target port and a target network address, and the method includes:
receiving a service processing request sent by a browser client through the target port and the target network address, wherein the service processing request is used for requesting a specified client to execute a specified service on a webpage currently displayed by the browser client;
checking the source of the service processing request;
and when the verification is passed, processing the service processing request.
In one aspect, a device for communicating between a web page and a client is provided, and is applied to a specific client, where the specific client is initialized to be a server and configured with a target port and a target network address, and the device includes:
a receiving module, configured to receive a service processing request sent by a browser client through the target port and the target network address, where the service processing request is used to request a specified client to execute a specified service on a webpage currently displayed by the browser client;
the verification module is used for verifying the source of the service processing request;
and the processing module is used for processing the service processing request when the verification is passed.
In one aspect, a terminal is provided, and the terminal includes: a processor; a memory for storing processing executable instructions; wherein the processor is configured to execute the computer program stored in the memory to implement the method steps of any aspect.
In one aspect, a computer-readable storage medium is provided, having stored thereon a computer program which, when being executed by a processor, carries out the method steps of any of the aspects.
The technical scheme provided by the embodiment of the invention has the following beneficial effects: the method has the advantages that the local server is realized on the appointed client, interaction can be carried out with the local server through the webpage in the service processing process, so that the service request and the service processing process are realized, due to the controllability of the local server, the safety of intercommunication between the webpage and the client can be guaranteed, the method can be suitable for any browser client, and the practicability is high.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic illustration of an implementation environment provided by an embodiment of the invention;
fig. 2 is a flowchart of a method for communication between a web page and a client according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a process of sending and receiving an HTTPS request according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a device for communication between a web page and a client according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal 500 according to an embodiment of the present invention;
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of an implementation environment according to an embodiment of the present invention, as shown in fig. 1, the implementation environment includes a terminal, a first server, and a second server, where the terminal and the server are connected through a network and may perform data interaction.
The terminal may be installed with at least one client, such as a browser client, an application management client, a social application client, and the like, and may implement multiple network functions through the at least one client, so as to meet the use requirements of the user. Taking the example that the web page access is realized through the browser client, the terminal can realize the intercommunication between the browser client and the specified client, and the intercommunication can be established on the basis of the HTTPS protocol to ensure the safety of the interaction and avoid the falsification of the interaction data by other people.
And the specified client may be served by the first server and the second server.
The first server is a background server of the specified client, and may be configured to perform initialization configuration on the specified client, for example, the first server may provide initialization information of the HTTPS for the specified client, such as a certificate, a supported service number, and a command number, so as to perform disaster prevention processing. In addition, the first server can also control the behavior of the specified client by starting and pausing the service number and/or the command number, and if the state of a certain service is abnormal, the first server can stop executing the service by remotely pausing the service number and/or the command number, thereby realizing the flexible control on the behavior of the client.
The second server is a service server, and can be a service for providing installation, service control and the like of the service plug-in for the specified client. When the user uses the appointed client, the user can customize the service to be realized, so that the appointed client downloads the service plug-in from the second server corresponding to the service. For example, when a user wants to implement an application update function through a specified client, the application update service may be set on the specified client. When the service plug-in executes the corresponding service, the service plug-in can be realized through interaction with the second server corresponding to the service plug-in. Each service may have a corresponding second server, and the second server may perform corresponding switching control on its own service, for example, suspend processing of a certain service.
HTTPS Hypertext Transfer Protocol Secure (English: Hypertext Transfer Protocol Secure, acronym: HTTPS, often referred to as HTTP over TLS, HTTP over SSL or HTTP Secure) is a network Secure transport Protocol. On computer networks, HTTPS communicates via hypertext transfer protocol, but encrypts packets with SSL/TLS. The main purpose of HTTPS development is to provide authentication to a network server, protecting the privacy and integrity of the exchanged data.
Jsonpjsonp (JSON with tagging) is a "usage mode" of JSON that can be used to solve the problem of cross-domain data access for mainstream browsers. Due to the same source policy, in general, a web page located in server1.example.com cannot communicate with a server that is not server1.example.com, but the < script > element of HTML is an exception. With this open policy of < script > elements, web pages can get JSON information dynamically generated from other sources, and this usage is called JSONP. The information acquired by the JSONP is not JSON information but arbitrary JavaScript data, and is directly executed by a JavaScript parser instead of being parsed by the JSON parser.
Fig. 2 is a flowchart of a method for communication between a web page and a client according to an embodiment of the present invention. Referring to fig. 2, the method comprises the steps of:
201. initializing a specified client as a server and configuring a target network address and a target port for the specified client.
The target network address is the network address of the specified client, and the target port is the server port of the specified client. The designated client can be configured as a local HTTPS server through the HTTPS protocol, and during the configuration of the server, an IP address, for example, 127.0.0.1, can be allocated to the designated client, and a port number can also be allocated to the designated client, so that the designated client can be accessed by other clients during the operation of the designated client. It should be noted that the target network address is a uniform IP address configured on all designated clients, so that the platform can write the target network address into a web page when the web page is created, and trigger the business processing flow.
It should be noted that the specified client may be an application management type client, and such a type of client operates on a terminal for a long time and can be set to start up, so that the specified client can be used as an interworking carrier to receive requests sent by other clients in an operating state, thereby processing the requests.
Taking HTTPS protocol as an example, during initialization, the designated client communicates with the first server to obtain initialization information of HTTPS, such as a certificate, a supported service number, a command number, and the like, and then initializes HTTPS service to establish a dedicated local HTTPS server on the terminal side. Then, each service plug-in unit is required to be loaded by the appointed client, so that different services can execute the command corresponding to the service number through the corresponding service plug-in unit in the appointed client, and finally, the service steps are realized. HTTPS is used as a communication protocol, so that tampering of communication data by an agent in the middle is mainly prevented, and safety is improved.
202. When a triggering instruction of a specified service on a webpage displayed by a browser client is acquired, a service processing request is generated, and the service processing request is used for requesting the specified client to execute the specified service.
The embodiment of the invention is only described by taking the example of displaying the webpage through the browser client as an example, in an actual scene, the webpage can be displayed through any browser plug-in, for example, through the browser plug-in the social application, a trigger mechanism of a specified service is already provided in a source code of the webpage, for example, in the display process of the webpage, if the current browser client or the social application client is detected to be an old version, an update prompt can be performed based on the new version, an option of the update prompt is displayed on a specified position of the webpage, after a trigger instruction for the option is obtained, it is determined that the specified service on the webpage is triggered, and a service processing request is generated based on a code segment corresponding to the option.
Further, when a specified service on the web page is triggered, a pseudo-random cookie is generated and written to the service processing request. The pseudo-random cookie can be pre-configured in the web page code or the generation algorithm thereof is pre-configured in the web page code, so that in order to avoid abuse of the function by illegal websites and the like, the pseudo-random cookie or the generation algorithm needs to be pre-configured in the web page code for verifying the service processing request by a specified client. Referring to the generation process in fig. 3, when generating a get (get) request, the get request may be regenerated by generating and writing a pseudo-random cookie, thereby initiating an HTTPS request to a specified client.
203. And the browser client sends the service processing request to a specified client.
Specifically, the browser client sends the service processing request to the target network address through the target port, and since the target port and the target network address can point to the designated client, the designated client receives the service processing request through the sending process.
204. And when the appointed client receives the service processing request, checking the domain name carried by the service processing request.
For a business processing request, it will carry the domain name of the source of the business processing request, so as to tell the specified client which web page to link from, and in order to avoid malicious attacks from other websites and other illegal situations, the specified client may only allow requests from some domain names. Taking the first preset condition as the case that the domain name is the preset domain name, the specified client may store the preset domain name, when receiving the service processing request, may determine that the domain name carried by the service processing request is not the preset domain name, if not, the verification fails, and the specified client may ignore or reject the service processing request. When the domain name is determined to be the preset domain name through verification, further verification can be continuously performed on the service processing request.
The preset domain name may be a domain name authenticated by the first server, and may be configured to a specific client by the first server when the client is initialized.
205. And when the domain name meets a first preset condition, the specified client checks the cookie carried by the service processing request.
As described in step 202 above, the service processing request may also carry a cookie, so that the specified client may verify the cookie by means of a cookie or a generation algorithm pre-configured at the client. Taking a second preset condition as an example that the cookie is the same as the preset cookie, the specified client can compare the pre-configured cookie with the cookie carried by the service processing request, if the comparison is consistent, the check is passed, and if the comparison is inconsistent, the check is failed; or, the specified client may generate a cookie according to a pre-configured cookie generation algorithm, compare the generated cookie with the cookie carried by the service processing request, if the comparison is consistent, the check is passed, and if the comparison is inconsistent, the check is failed.
206. And when the cookie accords with a second preset condition, the appointed client responds to the service processing request and determines a service plug-in corresponding to the service number in the appointed client according to the service number carried by the service processing request.
In order to implement a specific service, the service processing request carries a service number, where the service number is used to indicate which type of service is specifically executed by a specified client, and for any service number, a service plug-in corresponding to the service number may be loaded at the specified client, so that the specified client may be processed by the corresponding service plug-in when receiving the service processing request.
The above steps 204 to 206 are processes of checking the service processing request to ensure security, and in the above processes, domain name and cookie checking is taken as an example, for example, the sequence shown in fig. 3, but in an actual scenario, only domain name or cookie checking may be performed to accelerate the checking process and improve the efficiency of service processing. The check of the domain name and the cookie may not be limited to the check sequence, that is, the check process may be performed simultaneously or may be performed in tandem by using any time sequence, which is not limited in the embodiment of the present invention.
The verification process referred to in 204 to 206 is a process of verifying a source of the service processing request, and in an actual scenario, it is generally only allowed for a provider website or a collaboration website of a specific client to open the communication function, so as to ensure the security of service processing.
207. And the appointed client sends the service processing request to the service plug-in, and the service plug-in executes the processing step corresponding to the service processing request by adopting the command corresponding to the service number.
For a service number, its corresponding command number may represent the access right of the service on the terminal. Each service number may correspond to a plurality of command numbers, and the command numbers corresponding to the service numbers may be different, thereby implementing different service processing procedures. Of course, to achieve flexible control, both the service number and the command number may be activated or deactivated by remote control, thereby limiting the processing of a given client. By accessing various services through the extensible and maintainable plug-in technology, the services can be conveniently accessed, and the flexibility and controllability are very strong.
Further, for some services with high requirements on security and privacy, data related to the service is protected by public-private key encryption to prevent the data from being tampered, for example, a channel number of a certain service, and the like. Therefore, each service plug-in can correspondingly store a public key so as to decrypt the data. Correspondingly, the service plug-in adopts the public key corresponding to the service number to decrypt the data in the service processing request to obtain the data to be processed; and the processing module adopts the command corresponding to the service number to correspondingly process the data to be processed.
208. When data needs to be transmitted back to the webpage, the specified client transmits the data back to the webpage.
When any kind of data needs to be transmitted back, the appointed client can transmit back JavaScript data through the JSONP, so that the browser client can analyze and execute the data based on the JavaScript analyzer and perform corresponding product expression.
The method provided by the embodiment of the invention realizes a local server through the appointed client, and can realize the business request and the business processing process by interacting with the local server through the webpage in the business processing process. Furthermore, the method does not need to establish long connection with a background, and the timeliness of service processing is greatly improved. Meanwhile, the JSONP method is used for returning data, so that the stability of service implementation is improved, and the problem of difficulty in returning data in other intercommunication schemes is solved.
For example, when a browser client displays a web page, a user may trigger downloading of any resource through the web page, so that the browser client generates a download request, the browser client may send the download request to a specific client, for example, an application manager client, through an HTTPS protocol, and when the specific client receives the download request, the resource may be downloaded based on a web page link carried in the download request. Certainly, when receiving a download request, the specified client may check the domain name and the cookie thereof, and execute the resource download only when the check is passed, and when executing the resource download process, may also allocate the resource download task to the resource download plug-in to execute, and the resource download plug-in completes the entire download process based on the command corresponding to the resource download task.
For example, when a browser client displays a webpage, a user can trigger installation of any resource through the webpage, so that an installation request is generated by the browser client, the browser client can send the installation request to a specified client, such as an application manager client, through an HTTPS protocol, when the specified client receives the installation request, the resource can be downloaded based on a webpage link carried in the installation request, and after the downloading is completed, the resource is automatically installed. Certainly, when receiving the installation request, the specified client may check the domain name and the cookie thereof, and execute the resource downloading only when the check is passed, and when executing the resource downloading process, may also allocate the resource downloading and installation task to the resource installation plug-in to execute, and the resource installation plug-in completes the whole downloading and installation process based on the command corresponding to the resource downloading and installation task.
Fig. 4 is a schematic structural diagram of a device for performing communication between a web page and a client according to an embodiment of the present invention. The device includes:
a receiving module 401, configured to receive a service processing request sent by a browser client through the target port and the target network address, where the service processing request is used to request a specified client to execute a specified service on a webpage currently displayed by the browser client;
a verification module 402, configured to verify a source of the service processing request;
a processing module 403, configured to process the service processing request when the check passes.
In an implementation manner, the checking module 402 is configured to check a domain name carried by the service processing request, and when the domain name meets a first preset condition, it is determined that the service processing request passes the check.
In an implementation manner, the checking module 402 is configured to check a cache information cookie carried by the service processing request, and when the domain name meets the first preset condition and the cookie meets the second preset condition, determine that the service processing request passes the check.
In an implementation manner, the checking module 402 is configured to check a cookie carried by the service processing request, and when the cookie meets a second preset condition, determine that the service processing request is checked to be passed.
In an implementation manner, the apparatus further includes a backhaul module, configured to perform data backhaul by using the JSONP method when data needs to be backhaul to the webpage.
In one implementation, the processing module 403 is configured to:
determining a service plug-in corresponding to the service number according to the service number carried by the service processing request;
and issuing the service processing request to the service plug-in, and processing the service processing request by the service plug-in by adopting a command corresponding to the service number.
In one implementation, the processing module 403 is configured to:
the service plug-in adopts a public key corresponding to the service number to decrypt the data in the service processing request to obtain the data to be processed;
and the processing module adopts the command corresponding to the service number to correspondingly process the data to be processed.
In one implementation, the service processing request is in an HTTPS format.
In one implementation, the designated client is an application management class client.
In one implementation, the service processing request is a resource download request or a resource installation request.
It should be noted that: in the device for performing communication between a web page and a client according to the above embodiment, when the communication between the web page and the client is implemented, only the division of the functional modules is illustrated, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the device for performing communication between a web page and a client and the method embodiment for performing communication between a web page and a client provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
Fig. 5 is a block diagram of a terminal 500 according to an embodiment of the present invention. The terminal 500 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. Terminal 500 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, and the like.
In general, the terminal 500 includes: a processor 501 and a memory 502.
The processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 501 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 501 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, processor 501 may also include an AI (Artificial Intelligence) processor for processing computational operations related to machine learning.
Memory 502 may include one or more computer-readable storage media, which may be non-transitory. Memory 502 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 502 is used to store at least one instruction for execution by processor 501 to implement the selected content display method provided by the method embodiments of the present invention.
In some embodiments, the terminal 500 may further optionally include: a peripheral interface 503 and at least one peripheral. The processor 501, memory 502 and peripheral interface 503 may be connected by a bus or signal lines. Each peripheral may be connected to the peripheral interface 503 by a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 504, touch screen display 505, camera 506, audio circuitry 507, positioning components 508, and power supply 509.
The peripheral interface 503 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 501 and the memory 502. In some embodiments, the processor 501, memory 502, and peripheral interface 503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 501, the memory 502, and the peripheral interface 503 may be implemented on separate chips or circuit boards, which is not limited in this respect by the embodiments of the present invention.
The Radio Frequency circuit 504 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 504 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 504 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 504 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 504 may further include NFC (Near Field Communication) related circuits, which are not limited in the present disclosure.
The display screen 505 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 505 is a touch display screen, the display screen 505 also has the ability to capture touch signals on or over the surface of the display screen 505. The touch signal may be input to the processor 501 as a control signal for processing. At this point, the display screen 505 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 505 may be one, providing the front panel of the terminal 500; in other embodiments, the display screens 505 may be at least two, respectively disposed on different surfaces of the terminal 500 or in a folded design; in still other embodiments, the display 505 may be a flexible display disposed on a curved surface or on a folded surface of the terminal 500. Even more, the display screen 505 can be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display screen 505 may be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and other materials.
The camera assembly 506 is used to capture images or video. Optionally, camera assembly 506 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 506 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
Audio circuitry 507 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 501 for processing, or inputting the electric signals to the radio frequency circuit 504 to realize voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal 500. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 501 or the radio frequency circuit 504 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuitry 507 may also include a headphone jack.
The positioning component 508 is used for positioning the current geographic Location of the terminal 500 for navigation or LBS (Location Based Service). The Positioning component 508 may be a Positioning component based on the Global Positioning System (GPS) in the united states, the beidou System in china, or the galileo System in russia.
Power supply 509 is used to power the various components in terminal 500. The power source 509 may be alternating current, direct current, disposable or rechargeable. When power supply 509 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 500 also includes one or more sensors 510. The one or more sensors 510 include, but are not limited to: acceleration sensor 511, gyro sensor 512, pressure sensor 513, fingerprint sensor 514, optical sensor 515, and proximity sensor 516.
The acceleration sensor 511 may detect the magnitude of acceleration on three coordinate axes of the coordinate system established with the terminal 500. For example, the acceleration sensor 511 may be used to detect components of the gravitational acceleration in three coordinate axes. The processor 501 may control the touch screen 505 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 511. The acceleration sensor 511 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 512 may detect a body direction and a rotation angle of the terminal 500, and the gyro sensor 512 may cooperate with the acceleration sensor 511 to acquire a 3D motion of the user on the terminal 500. The processor 501 may implement the following functions according to the data collected by the gyro sensor 512: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
The pressure sensor 513 may be disposed on a side bezel of the terminal 500 and/or an underlying layer of the touch display screen 505. When the pressure sensor 513 is disposed on the side frame of the terminal 500, a user's holding signal of the terminal 500 may be detected, and the processor 501 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 513. When the pressure sensor 513 is disposed at the lower layer of the touch display screen 505, the processor 501 controls the operability control on the UI interface according to the pressure operation of the user on the touch display screen 505. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 514 is used for collecting a fingerprint of the user, and the processor 501 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 514, or the fingerprint sensor 514 identifies the identity of the user according to the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, the processor 501 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 514 may be provided on the front, back, or side of the terminal 500. When a physical button or a vendor Logo is provided on the terminal 500, the fingerprint sensor 514 may be integrated with the physical button or the vendor Logo.
The optical sensor 515 is used to collect the ambient light intensity. In one embodiment, the processor 501 may control the display brightness of the touch display screen 505 based on the ambient light intensity collected by the optical sensor 515. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 505 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 505 is turned down. In another embodiment, processor 501 may also dynamically adjust the shooting parameters of camera head assembly 506 based on the ambient light intensity collected by optical sensor 515.
A proximity sensor 516, also referred to as a distance sensor, is typically disposed on the front panel of the terminal 500. The proximity sensor 516 is used to collect the distance between the user and the front surface of the terminal 500. In one embodiment, when the proximity sensor 516 detects that the distance between the user and the front surface of the terminal 500 gradually decreases, the processor 501 controls the touch display screen 505 to switch from the bright screen state to the dark screen state; when the proximity sensor 516 detects that the distance between the user and the front surface of the terminal 500 becomes gradually larger, the processor 501 controls the touch display screen 505 to switch from the screen-rest state to the screen-on state.
Those skilled in the art will appreciate that the configuration shown in fig. 5 is not intended to be limiting of terminal 500 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
In an exemplary embodiment, a computer-readable storage medium, such as a memory, storing a computer program is also provided, which when executed by a processor implements the method illustrated in fig. 2 of the above embodiments. For example, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present invention and should not be taken as limiting the invention, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (7)

1. A method for communication between a webpage and a client, which is applied to a specified client, is initialized to be a server and is configured with a target port and a target network address, and comprises the following steps:
receiving a service processing request sent by a browser client through the target port and the target network address, wherein the service processing request is used for requesting a specified client to execute a specified service on a webpage currently displayed by the browser client, and the service processing request carries a domain name and a cookie;
checking the domain name and the cookie carried by the service processing request;
when the domain name meets a first preset condition and the cookie meets a second preset condition, determining that the service processing request passes verification;
when the verification is passed, determining a service plug-in corresponding to the service number according to the service number carried by the service processing request;
the service processing request is issued to the service plug-in, and the service plug-in decrypts the data in the service processing request by adopting a public key corresponding to the service number to obtain data to be processed;
the processing module adopts the command corresponding to the service number to correspondingly process the data to be processed;
and when data are required to be transmitted back to the webpage, transmitting back the data by adopting a JSONP method.
2. The method of claim 1, wherein the traffic handling request is in HTTPS format.
3. The method of claim 1, wherein the designated client is an application management class client.
4. The method of claim 1, wherein the service processing request is a resource download request or a resource install request.
5. An apparatus for communicating between a web page and a client, wherein the apparatus is applied to a specific client, the specific client is initialized to be a server and configured with a target port and a target network address, and the apparatus comprises:
a receiving module, configured to receive a service processing request sent by a browser client through the target port and the target network address, where the service processing request is used to request a specified client to execute a specified service on a webpage currently displayed by the browser client, and the service processing request carries a domain name and a cookie;
the checking module is used for checking the domain name and the cookie carried by the service processing request; when the domain name meets a first preset condition and the cookie meets a second preset condition, determining that the service processing request passes verification;
the processing module is used for determining a service plug-in corresponding to the service number according to the service number carried by the service processing request when the verification is passed; the service processing request is issued to the service plug-in, and the service plug-in decrypts the data in the service processing request by adopting a public key corresponding to the service number to obtain data to be processed; the processing module adopts the command corresponding to the service number to correspondingly process the data to be processed
And the return module is used for returning data by adopting a JSONP method when the data needs to be returned to the webpage.
6. A terminal, comprising:
a processor;
a memory for storing a computer program;
wherein the processor is adapted to execute a computer program stored on the memory to perform the method steps of any of claims 1-4.
7. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1-4.
CN201711340001.0A 2017-12-14 2017-12-14 Method and device for communication between webpage and client Active CN107959727B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711340001.0A CN107959727B (en) 2017-12-14 2017-12-14 Method and device for communication between webpage and client

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711340001.0A CN107959727B (en) 2017-12-14 2017-12-14 Method and device for communication between webpage and client

Publications (2)

Publication Number Publication Date
CN107959727A CN107959727A (en) 2018-04-24
CN107959727B true CN107959727B (en) 2021-10-29

Family

ID=61958943

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711340001.0A Active CN107959727B (en) 2017-12-14 2017-12-14 Method and device for communication between webpage and client

Country Status (1)

Country Link
CN (1) CN107959727B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111314396B (en) * 2018-12-11 2022-11-25 杭州海康威视数字技术股份有限公司 Data processing method and device
CN109617979A (en) * 2018-12-24 2019-04-12 珠海豹趣科技有限公司 A kind of data access method and relevant device
CN109800031A (en) * 2019-01-18 2019-05-24 广州虎牙信息科技有限公司 Service control method, server, terminal and device based on mobile office system
CN110516189B (en) 2019-08-29 2023-04-18 深圳市今天国际物流技术股份有限公司 Interface self-service method, device, computer equipment and storage medium
CN112506685B (en) * 2019-09-16 2022-11-25 浙江宇视科技有限公司 Log storage method and device
CN112214333B (en) * 2020-09-23 2023-08-22 安徽深迪科技有限公司 Method for applying HTTP protocol-based webpage and local application communication protocol

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101986652A (en) * 2010-09-27 2011-03-16 北京泰豪智能工程有限公司 Data sharing method and system based on embedded servers as well as client
CN105812345A (en) * 2014-12-31 2016-07-27 广州市动景计算机科技有限公司 Method and device for realizing communication between webpage and client end
CN106899455A (en) * 2017-03-07 2017-06-27 广州优视网络科技有限公司 The method and apparatus that a kind of client is interacted with webpage
CN106953740A (en) * 2017-01-24 2017-07-14 阿里巴巴集团控股有限公司 The processing method of page access data, client, server and system in
CN107038042A (en) * 2017-02-07 2017-08-11 阿里巴巴集团控股有限公司 The method and device that a kind of business is performed

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2379090A1 (en) * 2002-03-27 2003-09-27 Ibm Canada Limited-Ibm Canada Limitee Efficient server handling of multiple requests from a web browser
CN102917074B (en) * 2012-11-09 2016-08-03 北京奇虎科技有限公司 A kind of method realizing server-side browser and server
US9344512B2 (en) * 2012-12-13 2016-05-17 Qualcomm Incorporated Loading a re-directed web resource on a web browser of a client device in a communications system
CN104601433B (en) * 2013-10-30 2019-02-01 腾讯科技(深圳)有限公司 Application message window methods of exhibiting, client, server and system
US9648124B2 (en) * 2014-12-08 2017-05-09 International Business Machines Corporation Processing hybrid data using a single web client
CN104462478B (en) * 2014-12-18 2019-07-02 北京奇虎科技有限公司 Realize method, apparatus and client that mobile browser client accesses the web page
CN105357183A (en) * 2015-09-30 2016-02-24 广州酷狗计算机科技有限公司 Communication method and device between client and local webpage
CN105718517A (en) * 2016-01-14 2016-06-29 浪潮通用软件有限公司 Webpage display control method and system, and application server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101986652A (en) * 2010-09-27 2011-03-16 北京泰豪智能工程有限公司 Data sharing method and system based on embedded servers as well as client
CN105812345A (en) * 2014-12-31 2016-07-27 广州市动景计算机科技有限公司 Method and device for realizing communication between webpage and client end
CN106953740A (en) * 2017-01-24 2017-07-14 阿里巴巴集团控股有限公司 The processing method of page access data, client, server and system in
CN107038042A (en) * 2017-02-07 2017-08-11 阿里巴巴集团控股有限公司 The method and device that a kind of business is performed
CN106899455A (en) * 2017-03-07 2017-06-27 广州优视网络科技有限公司 The method and apparatus that a kind of client is interacted with webpage

Also Published As

Publication number Publication date
CN107959727A (en) 2018-04-24

Similar Documents

Publication Publication Date Title
CN107959727B (en) Method and device for communication between webpage and client
JP7338044B2 (en) Face image transmission method, value transfer method, device and electronic device
CN111444528B (en) Data security protection method, device and storage medium
CN110674022B (en) Behavior data acquisition method and device and storage medium
CN109547495B (en) Sensitive operation processing method, device, server, terminal and storage medium
CN108769992B (en) User authentication method, device, terminal and storage medium
CN107968783B (en) Traffic management method, device, terminal and computer readable storage medium
CN111092809B (en) Method and device for pushing information in real time, computer equipment and storage medium
CN110851823B (en) Data access method, device, terminal and storage medium
CN111159604A (en) Picture resource loading method and device
CN108616835B (en) Method, device and system for acquiring network resources based on browser and storage medium
CN108537040B (en) Method, device, terminal and storage medium for intercepting telecom fraud Trojan horse program
CN111523136A (en) Authority management method, device and equipment of application program and storage medium
CN110598386A (en) Data processing method, device and equipment based on block chain and storage medium
CN110263525B (en) Equipment configuration method and device
CN111191227A (en) Method and device for preventing malicious code from executing
CN111970298A (en) Application access method and device, storage medium and computer equipment
CN111881423A (en) Method, device and system for limiting function use authorization
CN113377647B (en) Page processing method, device, server, terminal and readable storage medium
CN115329309A (en) Verification method, verification device, electronic equipment and storage medium
CN112528311B (en) Data management method, device and terminal
CN110971692B (en) Method and device for opening service and computer storage medium
CN111131619B (en) Account switching processing method, device and system
CN113569219A (en) Live broadcast embedded program authorization method, device, equipment and storage medium
CN112764824B (en) Method, device, equipment and storage medium for triggering identity verification in application program

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
GR01 Patent grant
GR01 Patent grant