WO2016070690A1 - 实现终端设备上的网页和应用间通信的方法、装置和系统 - Google Patents

实现终端设备上的网页和应用间通信的方法、装置和系统 Download PDF

Info

Publication number
WO2016070690A1
WO2016070690A1 PCT/CN2015/090823 CN2015090823W WO2016070690A1 WO 2016070690 A1 WO2016070690 A1 WO 2016070690A1 CN 2015090823 W CN2015090823 W CN 2015090823W WO 2016070690 A1 WO2016070690 A1 WO 2016070690A1
Authority
WO
WIPO (PCT)
Prior art keywords
webpage
application
terminal device
execution request
command
Prior art date
Application number
PCT/CN2015/090823
Other languages
English (en)
French (fr)
Inventor
方顺豹
王昆
Original Assignee
北京奇虎科技有限公司
奇智软件(北京)有限公司
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 北京奇虎科技有限公司, 奇智软件(北京)有限公司 filed Critical 北京奇虎科技有限公司
Publication of WO2016070690A1 publication Critical patent/WO2016070690A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow

Definitions

  • the present invention relates to the field of Internet technologies, and in particular, to a method, device, and system for implementing webpage and inter-application communication on a terminal device.
  • terminal devices can support more and more online behaviors, enabling users to socialize, play, pay and other activities through various terminal devices anytime and anywhere, giving users life and work. Provides great convenience.
  • the webpage is a unified platform that can theoretically complete various online behaviors, at this stage, considering the system permissions and user security issues, some high-privilege and high-risk services cannot be executed in the webpage. Therefore, the user is in the terminal device.
  • the various online behaviors are generally performed by corresponding applications. For example, when the user wants to scan the application installed in the current terminal device, the application having the function of scanning the application needs to be opened for operation; the user needs to When the terminal device performs performance detection, it needs to open an application with performance detection function to operate; when the user wants to perform antivirus on the current terminal device, the application with antivirus function needs to be opened for operation. This brings great inconvenience to the user's operation, and the user experience is not high.
  • the present invention has been made in order to provide a method, apparatus and corresponding system for realizing web page and inter-application communication on a terminal device that overcomes the above problems or at least partially solves the above problems.
  • a method for implementing webpage and inter-application communication on a terminal device comprising:
  • the webpage on the terminal device sends a command execution request to the designated network port of the terminal device;
  • the webpage receives an operation result that the corresponding application performs a corresponding operation and returns after receiving the command execution request through the specified network port.
  • a method for implementing webpage and inter-application communication on a terminal device comprising:
  • the application on the terminal device listens to the designated network port of the terminal device, and receives a command execution request sent by the webpage on the terminal device through the designated network port;
  • the application performs a corresponding operation according to the command execution request, and returns the operation result to the webpage.
  • a network for implementing webpage and inter-application communication on a terminal device includes:
  • a command sending unit configured to send a command execution request to a designated network port of the terminal device
  • the operation result receiving unit is adapted to receive an operation result after the corresponding application receives the command execution request through the specified network port, and performs a corresponding operation and returns.
  • an application device for implementing webpage and inter-application communication on a terminal device includes:
  • a monitoring unit configured to listen to a specified network port of the terminal device, and receive, by using the specified network port, a command execution request sent by a webpage on the terminal device;
  • the execution unit is adapted to perform a corresponding operation according to the command execution request, and return the operation result to the webpage.
  • a system for implementing webpage and inter-application communication on a terminal device comprising: the webpage device and the application device as described in any one of the above.
  • a computer program comprising computer readable code, when the computer readable code is run on a computing device, causing the computing device to perform an implementation terminal according to the above The method of communication between web pages and applications on the device.
  • a computer readable medium storing the above computer program is provided.
  • the technical solution provided by the present invention uses a specified network port to send a command execution request to different applications on the same terminal device, and each application executes a request according to the command to perform a corresponding operation and returns the operation result to the webpage, and the webpage receives the operation result.
  • the communication between the webpage and the application on the terminal device is realized, thereby realizing the call of the webpage to the functions of each application, so that the webpage derives more functions that meet the user's requirements, greatly expanding the function of the webpage, and improving the user's webpage.
  • the operation rights of the terminal optimize the user experience and meet the needs of users.
  • FIG. 1 shows a flow chart of a method for implementing webpage and inter-application communication on a terminal device, in accordance with one embodiment of the present invention
  • FIG. 2 is a flow chart showing a method for implementing webpage and inter-application communication on a terminal device according to still another embodiment of the present invention
  • FIG. 3 is a flow chart showing a method for implementing webpage and inter-application communication on a terminal device according to another embodiment of the present invention
  • FIG. 4 is a schematic diagram showing an interaction process between a webpage and an inter-application communication on a terminal device according to an embodiment of the present invention
  • FIG. 5 is a schematic diagram of a webpage end device for implementing webpage and inter-application communication on a terminal device according to an embodiment of the present invention
  • FIG. 6 is a schematic diagram of a webpage end device for implementing webpage and inter-application communication on a terminal device according to an embodiment of the present invention
  • FIG. 7 is a schematic diagram of an application device for implementing webpage and inter-application communication on a terminal device according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of a system for implementing webpage and inter-application communication on a terminal device according to an embodiment of the present invention.
  • Figure 9 is a schematic block diagram of a computing device for performing a method of implementing web page and inter-application communication on a terminal device in accordance with the present invention.
  • Fig. 10 schematically shows a storage unit for holding or carrying program code implementing a method of realizing web page and inter-application communication on a terminal device according to the present invention.
  • FIG. 1 shows a flow chart of a method of implementing web page and inter-application communication on a terminal device in accordance with one embodiment of the present invention. As shown in Figure 1, the method includes:
  • Step S110 The webpage on the terminal device sends a command execution request to the designated network port of the terminal device.
  • the step may be: the webpage on the terminal device automatically sends a command execution request to the designated network port in a specific webpage scenario.
  • the user wants to download a certain game in the game APP (application) download page on the mobile phone, but the game has high performance requirements on the mobile phone.
  • the current webpage automatically sends a command execution request for detecting the performance of the mobile phone to the designated network port. In this way, it can be judged according to the execution result whether the current mobile phone supports the game, and if not, the user is prompted.
  • the step may be: the webpage on the terminal device sends a command execution request to the designated network port when a specific control on the webpage display interface is triggered.
  • the user also wants to download a game scene in the game APP download page on the mobile phone, and the game has higher performance requirements on the mobile phone, so the webpage is provided with a button for detecting the performance of the mobile phone, when the user presses the button, when The previous webpage sends a command execution request for detecting the performance of the mobile phone to the designated network port, so that it can also judge whether the current mobile phone supports the game according to the execution result, and prompt the user if it is not supported.
  • Step S120 The webpage receives the operation result that the corresponding application performs the corresponding operation and returns after receiving the command execution request through the designated network port.
  • the webpage and the application in the embodiment and the other embodiments are the webpages and applications on the same terminal device, that is, the webpage and the application on the same terminal device are solved by the present invention. Communication problems.
  • the terminal devices described herein include, but are not limited to, PCs (Personal Computers), PADs (tablets), mobile phones, and the like.
  • the method shown in FIG. 1 describes a process in which a webpage sends a command execution request to a different application on the same terminal device through a designated network port, and receives an operation result returned by each application, thereby realizing a call of a webpage to each application function.
  • the webpage is derived from more functions that meet the user's needs, greatly expanding the function of the webpage, improving the operation authority of the user on the webpage, and meeting the user's needs.
  • the command execution request sent by the webpage in step S120 to the designated network port of the terminal device is an HTTP request, including: specifying a port number of the network port, a command to be executed, and an identifier of an application that executes the command.
  • the command execution request may further include: a JS callback function, and in step S120 shown in FIG. 1, the webpage receives the operation result returned by the JS callback function.
  • command execution request is:
  • the URL "http://127.0.0.1:8359/qhapi?” represents the port number of the specified network port is 8359
  • FIG. 2 is a flow chart showing a method of implementing web page and inter-application communication on a terminal device in accordance with still another embodiment of the present invention. As shown in Figure 2, the method includes:
  • Step S210 The webpage on the terminal device sends a command execution request to the designated network port of the terminal device.
  • Step S220 the webpage receives the operation result that the corresponding application performs the corresponding operation and returns after receiving the command execution request through the designated network port;
  • Step S230 the webpage displays the operation result.
  • the steps S210 and S220 are the same as the steps S110 and S120 shown in FIG. 1 , and are not described here again; and the step S230 is applicable to the case that some operation results need to be displayed to the user, so that the user knows the The operation has been completed to improve the user experience.
  • the command execution request in step S110 of the method shown in FIG. 1 or step S210 of the method shown in FIG. 2 further includes: description information of the webpage.
  • the description of the web page can be the domain name of the web page or other relevant information.
  • the method shown in FIG. 1 or FIG. 2 after the webpage on the terminal device sends a command execution request to the designated network port of the terminal device, further includes: receiving, by the webpage, an application return corresponding to the identifier of the application included in the command execution request.
  • the feedback message indicating rejection is performed; after receiving the feedback message, the webpage sends a command execution request including an identifier of another application capable of executing the corresponding command to the designated network port of the terminal device.
  • the corresponding application rejects the call of the webpage and responds to the scenario of rejecting the execution of the message.
  • the webpage selects another application, and re-sends the command execution request to the selected application through the designated network port.
  • the webpage on the terminal device sends a command execution request to the designated network port corresponding to the application capable of executing the corresponding command.
  • the application development company A releases the designated network port with the port number 10000 to the public, the application developed by the company A is designed to listen to the network port 10000, and the web page sends a command execution request to the application developed by the company A. Need to be sent to network port 10000.
  • the application development company B issues a designated network port with the port number 10001 to the public, the application developed by the company B is designed to listen to the network port 10001, and the web page needs to send a command execution request when the application developed by the company B is sent. Go to network port 10001. And so on.
  • the application for detecting the performance of the terminal device is designed to listen to the network port 8359, and the application for downloading is designed to listen to the network port 8369.
  • a command execution request including the corresponding application identifier is sent to the network port 8369.
  • the method shown in FIG. 1 or FIG. 2 before the webpage on the terminal device sends a command execution request to the designated network port of the terminal device further includes: displaying the webpage on the terminal device An identifier of a plurality of applications that execute the corresponding command is selected by the user, and receives a selection result of the user; and the webpage on the terminal device sends a command execution request to the designated network port of the terminal device, where the webpage on the terminal device is: Sending a command execution request including the identifier of the application selected by the user to the designated network port corresponding to the application selected by the user. This provides the user with the option to select an appropriate application to complete an operation and improve the user experience.
  • a webpage needs to perform performance detection of a terminal device, it is known that three applications a, b, and c can perform the operation. At this time, the webpage displays the three applications to the user, and the user can learn according to his own experience or experience.
  • an application such as selecting application b
  • the web page sends a command execution request containing the identifier of the application b to the designated network port corresponding to the application b.
  • Application b through supervision Listen to the specified network port to receive the command execution request, perform the corresponding operation and return the result.
  • the command execution request described in step S110 of the method shown in FIG. 1 or step S210 of the method shown in FIG. 2 further includes: description information of the application.
  • the request contains the identification information of the requested application or the encrypted information that is agreed with the requested application, so that only the corresponding application is allowed to perform the corresponding operation.
  • FIG. 3 illustrates a flow chart of a method for implementing web page and inter-application communication on a terminal device in accordance with another embodiment of the present invention. As shown in FIG. 3, the method includes:
  • Step S310 The application on the terminal device listens to the designated network port of the terminal device, and receives a command execution request sent by the webpage on the terminal device by using the designated network port.
  • the application on the terminal device listening to the specified network port of the terminal device includes: the application has a first service initiated by the startup of the terminal device, and the first service listens to the designated network port.
  • an Android (Android) application can write a service that can be launched with the phone and can listen to the specified network port once it is started.
  • the command execution request in the embodiment shown in FIG. 3 may be an HTTP request, including: specifying a port number of a network port, a command to be executed, and an application for executing the command. logo.
  • the command execution request may further include a JS callback function.
  • the command execution request sent by the specified network port to receive the webpage sent by the terminal device is specifically: the application receives the command execution request including the identifier of the application by using the designated network port, that is, the application distinguishes the application identifier included in the command execution request. Whether the command execution request is sent to itself.
  • step S320 the application performs a corresponding operation according to the command execution request, and returns the operation result to the webpage.
  • the application performs the corresponding operation according to the command execution request, including: performing, by the second service in the application, the corresponding operation according to the command execution request; wherein the second service and the first service may be the same service, Can be two independent services.
  • the operation result is returned to the webpage through the JS callback function.
  • the command execution request described in the method shown in FIG. 3 further includes: description information of the webpage.
  • the description of the web page can be the domain name of the web page or other relevant information.
  • the method shown in FIG. 3 further includes: determining, according to the description information of the webpage in the command execution request, whether to perform a corresponding operation of the command execution request according to the execution request of the command execution request, where the application is Performing a corresponding operation according to the command execution request returns the operation result to the webpage, otherwise the application returns a feedback message indicating rejection of execution to the webpage.
  • the application can have the right to reject calls to certain web pages, such as malicious web pages, such as Trojan web pages or web pages embedded with malicious code.
  • an application on the terminal device listens to a designated network port of the terminal device corresponding to itself.
  • the applications of different classifications here may be classified according to the development company as mentioned above, or classified according to the functions performed by the application, and will not be repeated here.
  • the command execution request described in the method shown in FIG. 3 further includes: description information of the application.
  • the request contains the identification information of the requested application or the encrypted information that is agreed with the requested application, so that only the corresponding application is allowed to perform the corresponding operation.
  • the method shown in FIG. 3 describes that the application on the same terminal device as the webpage receives the command execution request through the designated network port, performs the operation, and returns the operation result, thereby realizing the timely execution of the command execution request sent by the application to the webpage.
  • the application can assist the webpage to complete some higher-privileged operations, expand the function of the webpage, thereby improving the user's operation authority on the webpage, and improving the user experience.
  • FIG. 4 is a schematic diagram showing an interaction process of a webpage and an inter-application communication on a terminal device according to an embodiment of the present invention.
  • a terminal device which may be a PC, a PAD, or a mobile phone
  • the device starts to listen to the designated network port, and when the webpage sends a command to the designated network port
  • the application receives the command execution request sent by the webpage through the designated network port, and the application performs the corresponding operation according to the command execution request, and returns the operation result to the webpage.
  • the webpage displays the operation result. .
  • the user browses an application download website on the webpage of the mobile phone, and the webpage page recommends a new high-end mobile game to the user, and the high-end mobile game has certain requirements for the mobile phone configuration, so the user downloads and installs the hand.
  • the webpage provides the user with the function of performing performance test on the current mobile phone, and the webpage itself cannot complete the performance test due to the limitation of the system permission. Therefore, the webpage needs to interact with the application that can perform performance testing, and the interaction process As follows: The web page sends a command execution request to the specified network port http://127.0.0.1:8359/qhapi?
  • the webpage sends a command execution request to the specified network port 8359
  • the application app1 (the application app1 has the function of performing performance test on the current mobile phone) performs performance test on the current mobile phone, and the application app1 passes the designated network port.
  • the 8359 analyzes the command to be executed, performs performance test on the current mobile phone, and returns the test result to the webpage through the callback function jsonp1.
  • the webpage receives the test result and displays the test result to the user on the webpage, that is, tells the user whether the current mobile phone configuration supports the running of the high-end mobile game. If it is not supported, it is recommended that the user change the game installation; if supported, the user can Download and install this high-end mobile game.
  • the web page can interact with the application that can download and install the game. The interaction process is as follows: The web page sends a command execution request to the specified network port http://127.0.0.1:8360/qhapi?
  • the webpage sends a command execution request to the designated network port 8360
  • the application app2 (the application app2 has the function of downloading and installing) downloads and installs the current mobile game, and the application app2 receives the specified network port 8360.
  • the command execution request analyze the command to be executed, download and install the current mobile game, and return the result of the download and installation to the webpage through the callback function jsonp2, and the webpage receives and displays the result of the download and installation completion to the user.
  • the above process realizes the interaction between the webpage end and the application end on the same terminal device, so that the user does not need to open each application to perform corresponding operations, thereby giving the user a smoother, more convenient and perfect user experience.
  • FIG. 5 is a schematic diagram of a webpage end device for implementing webpage and inter-application communication on a terminal device according to an embodiment of the present invention.
  • the webpage device 500 for implementing webpage and inter-application communication on the terminal device includes:
  • the command sending unit 510 is adapted to send a command execution request to the designated network port of the terminal device.
  • the command sending unit 510 may be adapted to automatically send a command execution request to the specified network port in a specific webpage scenario; or, when a specific control on the webpage display interface is triggered Sending a command execution request to the specified network port.
  • the operation result receiving unit 520 is adapted to receive an operation result that the corresponding application performs a corresponding operation and returns after receiving the command execution request through the designated network port.
  • the present embodiment describes a technical solution for the command sending unit 510 of the webpage device 500 to send a command execution request to a different application on the same terminal device by using a designated network port, and the operation result receiving unit 520 receives the operation result returned by each application.
  • the function of the webpage to the functions of each application end is realized, so that the webpage end derives more functions that meet the user's requirements, greatly expands the function of the webpage end, improves the operation authority of the user on the webpage end, and meets the user's needs.
  • the command execution request sent by the command sending unit 510 may be an HTTP request, including: specifying a port number of the network port, a command to be executed, and an identifier of an application for executing the command; and, in the command execution request It may further include: a JS callback function, and the operation result receiving unit 520 receives the operation result returned by the JS callback function.
  • command execution request sent by the command sending unit 510 is:
  • the URL "http://127.0.0.1:8359/qhapi?” represents the port number of the specified network port is 8359
  • FIG. 6 is a schematic diagram of a webpage device for implementing webpage and inter-application communication on a terminal device according to an embodiment of the present invention.
  • the webpage device 600 for implementing webpage and inter-application communication on the terminal device includes:
  • the command sending unit 610 is adapted to send a command execution request to the designated network port of the terminal device;
  • the operation result receiving unit 620 is adapted to receive an operation result after the corresponding application receives the command execution request through the designated network port, performs the corresponding operation, and returns the operation result;
  • the display unit 630 is adapted to display the operation result.
  • the command sending unit 610 and the operation result receiving unit 620 are the same as the command sending unit 510 and the operation result receiving unit 520 shown in FIG. 5, and details are not described herein again.
  • the display unit 630 is applicable to situations in which some operation results need to be displayed to the user, so that the user knows that the operation has been completed and improves the user experience.
  • the command execution request sent by the command sending unit 610 further includes: description information of the webpage.
  • the description information of the webpage may be the domain name of the webpage or other related information.
  • the command sending unit 610 is further adapted to receive a feedback message returned by the application corresponding to the identifier of the application included in the command execution request, indicating that the execution is rejected, and is adapted to send to the terminal device after receiving the feedback message.
  • the specified network port sends a command execution request containing an identification of other applications capable of executing the corresponding command.
  • the command sending unit 610 is adapted to send a command execution request to the designated network port corresponding to the application capable of executing the corresponding command.
  • the webpage end device 600 further includes: an application selecting unit 640 adapted to display an identifier of the plurality of applications capable of executing the corresponding command for the user to select, receive the selection result of the user, and send the command to the command sending unit. 610.
  • the command sending unit 610 is adapted to send a command execution request including an identifier of the application selected by the user to the designated network port corresponding to the application selected by the user.
  • FIG. 7 is a schematic diagram of an application device for implementing webpage and inter-application communication on a terminal device according to an embodiment of the present invention.
  • the application device 700 for implementing webpage and inter-application communication on the terminal device includes:
  • the monitoring unit 710 is adapted to listen to a designated network port of the terminal device, and receive a command execution request sent by the webpage on the terminal device by using the designated network port;
  • the executing unit 720 is adapted to perform a corresponding operation according to the command execution request, and return the operation result to the webpage.
  • the present embodiment describes that the listening unit 710 of the application device 700 on the same terminal device as the web page receives the command execution request by specifying the network port, and the execution unit 720 performs the operation and returns the operation result, thereby realizing the application device.
  • the timely and effective response to the command execution request of the webpage device enables the application end to assist the webpage to complete some higher-privileged operations, and expand the function of the webpage, thereby High user operation rights on the web page to improve the user experience.
  • the command execution request received by the listening unit 710 is an HTTP request, including: specifying a port number of the network port, a command to be executed, and executing.
  • the identifier of the application of the command may further include a JS callback function, which is not described here.
  • the monitoring unit 710 is configured to receive, by using the designated network port, a command execution request that includes an application identifier corresponding to the application device, and the monitoring unit 710 is adapted to be started with the startup of the terminal device, and the monitoring is specified after the startup. network port.
  • execution unit 720 is adapted to return the result of the operation to the web page via the JS callback function.
  • the listening unit 710 and the executing unit 720 can be run in the same service or in two independent services.
  • the command execution request received by the monitoring unit 710 further includes: description information of the webpage.
  • the executing unit 720 is further adapted to determine, according to the description information of the webpage, whether to perform a corresponding operation of the command execution request, according to the command execution request, and perform a corresponding operation according to the command execution request, Returning the result of the operation to the webpage, otherwise returning a feedback message indicating rejection of execution to the webpage.
  • the monitoring unit 710 is configured to listen to a specified network port of the terminal device corresponding to the application device, where there is one or more designated network ports that are agreed upon; Network port, different network ports correspond to different types of application devices.
  • FIG. 8 shows a schematic diagram of a system for implementing webpage and inter-application communication on a terminal device, in accordance with one embodiment of the present invention.
  • the system 800 includes a web page end device 810 and one or more application device devices 820.
  • the webpage end device 810 sends a command execution request to the designated network port, and the application device 820 receives the command execution request in the process of listening to the designated network port, performs a corresponding operation according to the command execution request, and returns the operation result to the webpage end device 810. After the web end device 810 receives the operation result, the operation result is displayed.
  • the system 800 realizes the interaction between the webpage device 810 and the application device 820 on the same terminal device, so that the user does not need to open each application to perform corresponding operations, thereby providing the user with a smoother, more convenient and perfect user experience.
  • the webpage end device 810 may be the webpage end device 500 implementing the webpage and inter-application communication on the terminal device shown in FIG. 5, or the webpage on the implementation terminal device shown in 6.
  • the application device 820 is the application device 700 for implementing webpage and inter-application communication on the terminal device as shown in FIG.
  • the technical solution provided by the present invention realizes the call of the webpage to each application through the communication between the webpage and the application on the terminal device, so that the operation authority of the webpage is greatly improved, the operation service is greatly expanded, and the user experience is improved.
  • modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment.
  • the modules or units or components of the embodiments may be combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components.
  • any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the device are combined.
  • Each feature disclosed in this specification (including the accompanying claims, the abstract and the drawings) may be replaced by alternative features that provide the same, equivalent or similar purpose.
  • the various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor may be used in practice to implement some of the devices and systems for implementing web page and inter-application communication on a terminal device in accordance with embodiments of the present invention or Some or all of the features of all components.
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • Such a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
  • Figure 9 illustrates a computing device that can implement a method of web page and inter-application communication on a terminal device.
  • the computing device conventionally includes a processor 910 and a computer program product or computing in the form of a memory 920 Machine readable medium.
  • the memory 920 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM.
  • Memory 920 has a memory space 930 for program code 931 for performing any of the method steps described above.
  • storage space 930 for program code may include various program code 931 for implementing various steps in the above methods, respectively.
  • the program code can be read from or written to one or more computer program products.
  • Such computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks.
  • Such a computer program product is typically a portable or fixed storage unit as described with reference to FIG.
  • the storage unit may have storage segments, storage spaces, and the like that are similarly arranged to memory 920 in the computing device of FIG.
  • the program code can be compressed, for example, in an appropriate form.
  • the storage unit includes computer readable code 931', ie, code that can be read by a processor, such as 910, that when executed by a computing device causes the computing device to perform each of the methods described above step.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明公开了一种实现终端设备上的网页和应用间通信的方法、装置和系统。所述方法包括:终端设备上的网页向终端设备的指定网络端口发送命令执行请求;终端设备上的应用监听终端设备的指定网络端口,通过指定网络端口接收终端设备上的网页发送的命令执行请求;网页接收相应的应用通过指定网络端口接收到命令执行请求后,执行相应的操作并返回的操作结果。应用根据命令执行请求执行相应的操作,将操作结果返回给所述网页。本发明提供的技术方案实现了网页对各应用的功能的调用,使得网页衍生出更多符合用户需求的功能,极大地扩展了网页的功能,提高了用户在网页端的操作权限,优化用户体验,满足用户需求。

Description

实现终端设备上的网页和应用间通信的方法、装置和系统 技术领域
本发明涉及互联网技术领域,具体涉及一种实现终端设备上的网页和应用间通信的方法、装置和系统。
背景技术
随着互联网技术的飞速发展,各种各样的终端设备可以支持越来越多的网上行为,使得用户随时随地可以通过各种终端设备进行社交、游戏、支付等活动,给用户的生活和工作提供了极大的便利。
虽然,网页是理论上可以完成各种网上行为的统一平台,但是在现阶段,考虑到系统权限、用户安全等问题,网页中不能执行一些高权限、高风险的业务,因此,用户在终端设备上进行各种网上行为一般是通过对应的应用程序来完成的,比如:用户要对当前终端设备中安装的应用程序进行扫描时,需要打开具有扫描应用程序功能的应用进行操作;用户要对当前的终端设备进行性能检测时,需要打开具有性能检测功能的应用进行操作;用户要对当前的终端设备进行杀毒时,需要打开具有杀毒功能的应用进行操作等。这给用户的操作带来了很大的不便,用户体验不高。
因此,如何实现终端设备上的网页和应用间的有效、流畅地通信,进而扩展网页的功能和业务,对于技术发展、用户需求都具有重要的意义。
发明内容
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的实现终端设备上的网页和应用间通信的方法、装置和相应的系统。
依据本发明的一方面,提供了一种实现终端设备上的网页和应用间通信的方法,该方法包括:
终端设备上的网页向所述终端设备的指定网络端口发送命令执行请求;
所述网页接收相应的应用通过所述指定网络端口接收到所述命令执行请求后,执行相应的操作并返回的操作结果。
根据本发明的另一方面,提供了一种实现终端设备上的网页和应用间通信的方法,该方法包括:
终端设备上的应用监听所述终端设备的指定网络端口,通过所述指定网络端口接收所述终端设备上的网页发送的命令执行请求;
所述应用根据所述命令执行请求执行相应的操作,将操作结果返回给所述网页。
根据本发明的又一方面,提供了一种实现终端设备上的网页和应用间通信的网 页端装置,该网页端装置包括:
命令发送单元,适于向所述终端设备的指定网络端口发送命令执行请求;
操作结果接收单元,适于接收相应的应用通过所述指定网络端口接收到所述命令执行请求后,执行相应的操作并返回的操作结果。
根据本发明的又一方面,提供了一种实现终端设备上的网页和应用间通信的应用端装置,该应用端装置包括:
监听单元,适于监听所述终端设备的指定网络端口,通过所述指定网络端口接收所述终端设备上的网页发送的命令执行请求;
执行单元,适于根据所述命令执行请求执行相应的操作,将操作结果返回给所述网页。
根据本发明的又一方面,提供了一种实现终端设备上的网页和应用间通信的系统,该系统包括:如上任一项中所述的网页端装置和应用端装置。
根据本发明的又一方面,提供了一种计算机程序,其包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行根据上文所述的实现终端设备上的网页和应用间通信的方法。
根据本发明的再一方面,提供了一种计算机可读介质,其中存储了上述的计算机程序。
本发明的有益效果为:
本发明提供的技术方案通过网页利用指定网络端口向同一终端设备上的不同应用发送命令执行请求,各应用根据该命令执行请求执行相应操作并将操作结果返回给网页,网页接收操作结果的过程,实现了终端设备上的网页和应用间的通信,进而实现了网页对各应用的功能的调用,使得网页衍生出更多符合用户需求的功能,极大地扩展了网页的功能,提高了用户在网页端的操作权限,优化用户体验,满足用户需求。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1示出了根据本发明一个实施例的一种实现终端设备上的网页和应用间通信的方法的流程图;
图2示出了根据本发明又一个实施例的一种实现终端设备上的网页和应用间通信的方法的流程图;
图3示出了根据本发明另一个实施例的一种实现终端设备上的网页和应用间通信的方法的流程图;
图4示出了根据本发明一个实施例的终端设备上的网页和应用间通信的交互过程示意图;
图5示出了根据本发明一个实施例的一种实现终端设备上的网页和应用间通信的网页端装置的示意图;
图6示出了根据本发明一个实施例的一种实现终端设备上的网页和应用间通信的网页端装置的示意图;
图7示出了根据本发明一个实施例的一种实现终端设备上的网页和应用间通信的应用端装置的示意图;
图8示出了根据本发明一个实施例的一种实现终端设备上的网页和应用间通信的系统的示意图;
图9示意性地示出了用于执行根据本发明的实现终端设备上的网页和应用间通信的方法的计算设备的框图;以及
图10示意性地示出了用于保持或者携带实现根据本发明的实现终端设备上的网页和应用间通信的方法的程序代码的存储单元。
具体实施方式
下面结合附图和具体的实施方式对本发明作进一步的描述。
图1示出了根据本发明一个实施例的一种实现终端设备上的网页和应用间通信的方法的流程图。如图1所示,该方法包括:
步骤S110,终端设备上的网页向该终端设备的指定网络端口发送命令执行请求;
在本发明的一个实施例中,本步骤可以是:该终端设备上的网页,在特定的网页场景下,自动向指定网络端口发送命令执行请求。例如,用户在手机上的游戏APP(应用)下载页面中,想下载某个游戏,但该游戏对手机性能要求较高,此时当前网页自动向指定网络端口发送检测手机性能的命令执行请求,这样可以根据执行结果来判断当前的手机是否支持该游戏,如果不支持则提示用户。
或者,在本发明的一个实施例中,本步骤也可以是:该终端设备上的网页,当网页显示界面上的特定控件被触发时,向指定网络端口发送命令执行请求。例如,也是用户在手机上的游戏APP下载页面中,想下载某个游戏的场景,该游戏对手机性能要求较高,所以网页上设置有检测手机性能的按钮,当用户按下该按钮时,当 前网页向指定网络端口发送检测手机性能的命令执行请求,这样也可以根据执行结果来判断当前的手机是否支持该游戏,如果不支持则提示用户。
步骤S120,网页接收相应的应用通过指定网络端口接收到命令执行请求后,执行相应的操作并返回的操作结果。
需要说明的是,本实施例以及下文中提到其他实施例中的网页和应用,均是在同一个终端设备上的网页和应用,即本发明解决的是同终端设备上的网页和应用进行通信的问题。而这里所述的终端设备包括但不限于如下设备:PC(Personal Computer,个人电脑)、PAD(平板电脑)、手机等等。
可见,图1所示的方法描述了网页通过指定网络端口向同一终端设备上的不同应用发送命令执行请求,并接收各应用返回的操作结果的过程,实现了网页对各应用的功能的调用,使得网页衍生出更多符合用户需求的功能,极大地扩展了网页的功能,提高了用户在网页上的操作权限,符合用户需求。
在本发明的一个实施例中,步骤S120中的网页向终端设备的指定网络端口发送的命令执行请求为HTTP请求,包括:指定网络端口的端口号、要执行的命令和执行命令的应用的标识。并且,命令执行请求中还可以包括:JS回调函数,则图1所示的步骤S120中,网页接收通过JS回调函数返回的操作结果。
例如:命令执行请求为:
http://127.0.0.1:8359/qhapi?client=gameunion&command=alive&callback=jsonp1;
其中,URL“http://127.0.0.1:8359/qhapi?”代表指定网络端口的端口号为8359,“client=gameunion”代表执行命令的应用的标识,“command=alive”代表要执行的命令,“callback=jsonp1”代表执行命令后的JS回调函数;因此,命令执行请求通过HTTP请求的参数进行传递即可,便于扩展出对不同应用的不同命令。
图2示出了根据本发明又一个实施例的一种实现终端设备上的网页和应用间通信的方法的流程图。如图2所示,该方法包括:
步骤S210,终端设备上的网页向该终端设备的指定网络端口发送命令执行请求;
步骤S220,网页接收相应的应用通过指定网络端口接收到命令执行请求后,执行相应的操作并返回的操作结果;
步骤S230,网页展示操作结果。
在本实施例中,步骤S210、步骤S220与图1所示的步骤S110、步骤S120相同,在此不再赘述;而步骤S230适用于一些操作结果需要向用户展示的情况,使得用户得知该操作已经完成,提高用户体验。
在本发明的一个实施例中,图1所示方法的步骤S110中或者图2所示方法的步骤S210中所述的命令执行请求中还包括:网页的描述信息。网页的描述信息可以网页的域名,或是其他相关信息。则图1或者图2所示的方法在终端设备上的网页向该终端设备的指定网络端口发送命令执行请求之后,进一步包括:网页接收所述命令执行请求中包含的应用的标识对应的应用返回的,表示拒绝执行的反馈消息;该网页接收到所述反馈消息后,向终端设备的指定网络端口发送包含能够执行相应命令的其他应用的标识的命令执行请求。这种情况是指相应的应用拒绝网页的调用,回复拒绝执行消息的场景,此时网页选择其他的应用,并重新通过指定网络端口向该选择的应用发送命令执行请求。
在本发明的一个实施例中,图1或图2所示的方法中,终端设备上的网页,是向能够执行相应命令的应用所对应的指定网络端口发送命令执行请求。其中,存在约定好的一个或者多个指定网络端口;如存在多个指定网络端口,不同的网络端口对应不同分类的应用。即约定好的指定网络端口有多个,不同的应用对应不同的指定网络端口,发送命令执行请求时需要进行区分。
例如,应用开发公司A对公众发布了,端口号为10000的指定的网络端口,则该公司A开发的应用都设计为监听网络端口10000,网页向该公司A开发的应用发送命令执行请求时都需要发送到网络端口10000。又例如应用开发公司B对公众发布了端口号为10001的指定网络端口,则该公司B开发的应用都设计为监听网络端口10001,网页向该公司B开发的应用发送命令执行请求时都需要发送到网络端口10001。以此类推。
又或者,按照应用的功能进行划分,进行终端设备性能检测的应用都设计为监听网络端口8359,进行下载操作的应用都设计为监听网络端口8369。则网页需要进行下载操作时,向网络端口8369发送包含相应应用标识的命令执行请求。
在本发明的一个实施例中,图1或者图2所示的方法,在终端设备上的网页向所述终端设备的指定网络端口发送命令执行请求之前,进一步包括:终端设备上的网页展示能够执行相应命令的多个应用的标识供用户进行选择,并接收用户的选择结果;所述终端设备上的网页向所述终端设备的指定网络端口发送命令执行请求包括:所述终端设备上的网页向用户选择的应用所对应的指定网络端口,发送包含用户选择的应用的标识的命令执行请求。这样可以为用户提供选择权,用户可以选择合适应用完成一项操作,提高了用户体验。例如,当网页需要执行终端设备的性能检测时,已知有3款应用a、b、c都能执行该操作,此时网页将该3款应用展示给用户,用户可以根据自身的了解或者经验来选择一款应用,如选择应用b,则网页就向应用b对应的指定网络端口发送包含应用b的标识的命令执行请求。应用b通过监 听对应指定网络端口收到该命令执行请求,执行相应操作并返回结果。
在本发明的另一个实施例中,图1所示方法的步骤S110中或者图2所示方法的步骤S210中所述的命令执行请求中还包括:应用的描述信息。例如该请求包含所请求的应用的标识信息,或与该所请求的应用协商一致的加密信息,从而只允许与其对应的应用执行相应的操作。图3示出了根据本发明另一个实施例的一种实现终端设备上的网页和应用间通信的方法的流程图。如图3所示,该方法包括:
步骤S310,终端设备上的应用监听该终端设备的指定网络端口,通过指定网络端口接收终端设备上的网页发送的命令执行请求。
在本步骤中,终端设备上的应用监听该终端设备的指定网络端口包括:应用中有一个随终端设备的启动而启动的第一服务,由该第一服务来监听指定网络端口。例如,Android(安卓)的应用程序可以编写一个service,这个service可以随手机一起启动,一旦启动就可以监听指定网络端口。
与图1、图2所示的实施例中相同,本图3所示实施例中的命令执行请求可以为HTTP请求,包括:指定网络端口的端口号、要执行的命令和执行命令的应用的标识。命令执行请求还可以进一步包括JS回调函数。对应地,通过指定网络端口接收终端设备上的网页发送的命令执行请求具体为:应用通过指定网络端口接收包含本应用的标识的命令执行请求,即应用通过命令执行请求中包含的应用标识来区分该命令执行请求是否是发给自己的。
步骤S320,应用根据命令执行请求执行相应的操作,将操作结果返回给网页。
在本步骤中,应用根据命令执行请求执行相应的操作包括:由应用中的第二服务根据命令执行请求执行相应的操作;其中,第二服务和上述的第一服务可以为同一个服务,也可以为独立的两个服务。
本步骤中,如果命令执行请求中包含JS回调函数,则将操作结果通过该JS回调函数返回给网页。
在本发明的一个实施例中,图3所示方法中所述的命令执行请求中还包括:网页的描述信息。网页的描述信息可以网页的域名,或是其他相关信息。图3所示的方法在应用根据所述命令执行请求执行相应的操作之前,进一步包括:根据命令执行请求中的网页的描述信息判断是否执行所述命令执行请求的相应操作,是则所述应用根据所述命令执行请求执行相应的操作,将操作结果返回给所述网页,否则应用向网页返回表示拒绝执行的反馈消息。这样应用端可以有权利拒绝一些网页的调用,例如恶意网页,如木马网页或者嵌入恶意代码的网页等等。
在本发明的一个实施例中,在图3所示的方法中,终端设备上的应用监听所述终端设备的与自身对应的指定网络端口。其中存在约定好的一个或者多个指定网络 端口;如存在多个指定网络端口,不同的网络端口对应不同分类的应用。这里不同分类的应用可以是如前面提到的按照开发公司进行分类,或者按照应用所执行的功能进行分类,这里不再复述。
在本发明的一个实施例中,图3所示方法中所述的命令执行请求中还包括:应用的描述信息。例如该请求包含所请求的应用的标识信息,或与该所请求的应用协商一致的加密信息,从而只允许与其对应的应用执行相应的操作。
可见,图3所示的方法描述了与网页在同一终端设备上的应用通过指定网络端口接收命令执行请求,执行操作并返回操作结果的过程,实现了应用对网页发出的命令执行请求的及时、有效地响应,使得应用可以协助网页完成一些权限较高的操作,扩展网页的功能,进而提高用户在网页上的操作权限,提高用户体验。
图4示出了根据本发明一个实施例的终端设备上的网页和应用间通信的交互过程示意图。如图4所示,在一个终端设备(可以是PC、PAD或手机)上,应用的第一服务随终端设备的启动而启动后,开始监听指定网络端口,当网页向该指定网络端口发送命令执行请求时,应用通过该指定网络端口接收到网页发送的命令执行请求,应用根据该命令执行请求执行相应的操作,并将操作结果返回给网页,网页接收到该操作结果后,展示该操作结果。
例如:用户在手机的网页端浏览一个应用下载网站,该网页页面向用户推荐了一款最新的高端手游,而该高端手游对手机配置有一定的要求,因此,在用户下载安装该手游之前,网页向用户提供了对当前手机进行性能测试的功能,而由于系统权限限制,网页自身是无法完成该性能测试的,因此,该网页需要与可以进行性能测试的应用实现交互,交互过程如下:网页向指定网络端口发送命令执行请求http://127.0.0.1:8359/qhapi?client=app1&command=performancetest&callback=jsonp1,即网页向指定网络端口8359发送命令执行请求,要求应用app1(该应用app1具有对当前手机进行性能测试的功能)对当前手机进行性能测试,应用app1通过指定网络端口8359接收到该命令执行请求后,分析要执行的命令,对当前手机进行性能测试,并将测试结果通过回调函数jsonp1返回给网页。
网页接收到测试结果,在网页上向用户展示该测试结果,即告诉用户当前手机的配置是否支持该高端手游的运行,如果不支持,建议用户换一款游戏安装;如果支持,用户即可以下载安装此款高端手游,此时,网页又可以与可以进行游戏下载安装的应用进行交互,交互过程如下:网页向指定网络端口发送命令执行请求http://127.0.0.1:8360/qhapi?client=app2&command=download&callback=jsonp2,即网页向指定网络端口8360发送命令执行请求,要求应用app2(该应用app2具有对下载安装的功能)对当前手游进行下载安装,应用app2通过指定网络端口8360接收 到该命令执行请求后,分析要执行的命令,对当前手游进行下载安装,并将下载安装完成的结果通过回调函数jsonp2返回给网页,网页接收到并向用户展示该下载安装完成的结果。
上述过程实现了同一终端设备上的网页端和应用端的交互,使得用户无需打开各个应用进行相应的操作,给用户更为流畅、便捷、完美的用户体验。
图5示出了根据本发明一个实施例的一种实现终端设备上的网页和应用间通信的网页端装置的示意图。如图5所示,该实现终端设备上的网页和应用间通信的网页端装置500包括:
命令发送单元510,适于向终端设备的指定网络端口发送命令执行请求。
在本发明的实施例中,命令发送单元510,可以适于在特定的网页场景下,自动向所述指定网络端口发送命令执行请求;或者,适于在网页显示界面上的特定控件被触发时,向所述指定网络端口发送命令执行请求。
操作结果接收单元520,适于接收相应的应用通过指定网络端口接收到命令执行请求后,执行相应的操作并返回的操作结果。
可知,本实施例描述了实现网页端装置500的命令发送单元510通过指定网络端口向同一终端设备上的不同应用发送命令执行请求,操作结果接收单元520接收各应用返回的操作结果的技术方案,实现了网页端对各应用端的功能的调用,使得网页端衍生出更多符合用户需求的功能,极大地扩展了网页端的功能,提高了用户在网页端的操作权限,符合用户需求。
在本发明的一个实施例中,命令发送单元510发送的命令执行请求可以为HTTP请求,包括:指定网络端口的端口号、要执行的命令和执行命令的应用的标识;并且,命令执行请求中还可以包括:JS回调函数,操作结果接收单元520接收通过JS回调函数返回的操作结果。
例如:命令发送单元510发送的命令执行请求为:
http://127.0.0.1:8359/qhapi?client=gameunion&command=alive&callback=jsonp1;
其中,URL“http://127.0.0.1:8359/qhapi?”代表指定网络端口的端口号为8359,“client=gameunion”代表执行命令的应用的标识,“command=alive”代表要执行的命令,“callback=jsonp1”代表执行命令后的JS回调函数;因此,命令执行请求通过HTTP请求的参数进行传递即可,便于扩展出对不同应用的不同命令。
图6示出了根据本发明一个实施例的一种实现终端设备上的网页和应用间通信的网页端装置的示意图。如图6所示,该实现终端设备上的网页和应用间通信的网页端装置600包括:
命令发送单元610,适于向终端设备的指定网络端口发送命令执行请求;
操作结果接收单元620,适于接收相应的应用通过指定网络端口接收到命令执行请求后,执行相应的操作并返回的操作结果;
展示单元630,适于展示操作结果。
在本实施例中,命令发送单元610、操作结果接收单元620与图5所示的命令发送单元510、操作结果接收单元520相同,在此不再赘述。而展示单元630适用于一些操作结果需要向用户展示的情况,使得用户得知该操作已经完成,提高用户体验。
在本发明的一个实施例中,命令发送单元610发送的所述命令执行请求中还包括:网页的描述信息。网页的描述信息可以网页的域名或者是其他相关信息。
命令发送单元610,进一步适于接收所述命令执行请求中包含的应用的标识对应的应用返回的,表示拒绝执行的反馈消息;以及适于在接收到所述反馈消息后,向所述终端设备的指定网络端口发送包含能够执行相应命令的其他应用的标识的命令执行请求。
在本发明的一个实施例中,命令发送单元610,适于向能够执行相应命令的应用所对应的指定网络端口发送命令执行请求。其中,存在约定好的一个或者多个指定网络端口;如存在多个指定网络端口,不同的网络端口对应不同分类的应用。
在本发明的一个实施例中,网页端装置600进一步包括:应用选择单元640,适于展示能够执行相应命令的多个应用的标识供用户进行选择,接收用户的选择结果并发送给命令发送单元610。
命令发送单元610,适于向用户选择的应用所对应的指定网络端口,发送包含用户选择的应用的标识的命令执行请求。
图7示出了根据本发明一个实施例的一种实现终端设备上的网页和应用间通信的应用端装置的示意图。如图7所示,该实现终端设备上的网页和应用间通信的应用端装置700包括:
监听单元710,适于监听终端设备的指定网络端口,通过指定网络端口接收该终端设备上的网页发送的命令执行请求;
执行单元720,适于根据命令执行请求执行相应的操作,将操作结果返回给网页。
可知,本实施例描述了与网页在同一终端设备上的应用端装置700的监听单元710通过指定网络端口接收命令执行请求,执行单元720执行操作并返回操作结果的技术方案,实现了应用端装置对网页端装置的命令执行请求的及时、有效地响应,使得应用端可以协助网页端完成一些权限较高的操作,扩展网页端的功能,进而提 高用户在网页端的操作权限,提高用户体验。
在本发明的一个实施例中,与图5、图6所示的实施例中相同,监听单元710接收的命令执行请求为HTTP请求,包括:指定网络端口的端口号、要执行的命令和执行命令的应用的标识,还可以进一步包括JS回调函数,在此不再赘述。对应地,监听单元710,适于通过指定网络端口接收包含与本应用端装置对应的应用标识的命令执行请求;并且,监听单元710,适于随终端设备的启动而启动,启动后即监听指定网络端口。此外,如果命令执行请求中包含JS回调函数,则执行单元720适于将操作结果通过该JS回调函数返回给网页。
其中,监听单元710和执行单元720可以运行在同一个服务中,也可以运行在独立的两个服务中。
在本发明的一个实施例中,监听单元710接收的命令执行请求中还包括:网页的描述信息。
执行单元720,在根据所述命令执行请求执行相应的操作之前,进一步适于根据网页的描述信息判断是否执行所述所述命令执行请求的相应操作,是则根据命令执行请求执行相应的操作,将操作结果返回给所述网页,否则向网页返回表示拒绝执行的反馈消息。
在本发明的一个实施例中,监听单元710,适于监听所述终端设备的与本应用端装置对应的指定网络端口.其中存在约定好的一个或者多个指定网络端口;如存在多个指定网络端口,不同的网络端口对应不同分类的应用端装置。
图8示出了根据本发明一个实施例的一种实现终端设备上的网页和应用间通信的系统的示意图。如图8所示,该系统800包括:网页端装置810,以及一个或多个应用端装置820。
网页端装置810向指定网络端口发送命令执行请求,应用端装置820在监听指定网络端口的过程中接收到该命令执行请求,根据该命令执行请求执行相应的操作,将操作结果返回网页端装置810,网页端装置810接收到操作结果后,展示该操作结果。
由上述可知,系统800实现了同一终端设备上的网页端装置810和应用端装置820的交互,使得用户无需打开各个应用分别进行相应的操作,给用户更为流畅、便捷、完美的用户体验。
在本发明的一个实施例中,网页端装置810可以是图5中所示的实现终端设备上的网页和应用间通信的网页端装置500,或者是6中所示的实现终端设备上的网页和应用间通信的网页端装置600;应用端装置820是图7中所示的实现终端设备上的网页和应用间通信的应用端装置700。
综上所述,本发明提供的技术方案通过终端设备上的网页和应用间的通信,实现了网页对各应用的调用,使得网页端的操作权限大幅提高、操作业务大幅扩展,提高用户体验。
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的实现终端设备上的网页和应用间通信的装置和系统中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。
例如,图9示出了可以实现终端设备上的网页和应用间通信的方法的计算设备。该计算设备传统上包括处理器910和以存储器920形式的计算机程序产品或者计算 机可读介质。存储器920可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器920具有用于执行上述方法中的任何方法步骤的程序代码931的存储空间930。例如,用于程序代码的存储空间930可以包括分别用于实现上面的方法中的各种步骤的各个程序代码931。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为如参考图10所述的便携式或者固定存储单元。该存储单元可以具有与图9的计算设备中的存储器920类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括计算机可读代码931’,即可以由例如诸如910之类的处理器读取的代码,这些代码当由计算设备运行时,导致该计算设备执行上面所描述的方法中的各个步骤。
本文中所称的“一个实施例”、“实施例”或者“一个或者多个实施例”意味着,结合实施例描述的特定特征、结构或者特性包括在本发明的至少一个实施例中。此外,请注意,这里“在一个实施例中”的词语例子不一定全指同一个实施例。
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。
此外,还应当注意,本说明书中使用的语言主要是为了可读性和教导的目的而选择的,而不是为了解释或者限定本发明的主题而选择的。因此,在不偏离所附权利要求书的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。对于本发明的范围,对本发明所做的公开是说明性的,而非限制性的,本发明的范围由所附权利要求书限定。

Claims (33)

  1. 一种实现终端设备上的网页和应用间通信的方法,其中,该方法包括:
    终端设备上的网页向所述终端设备的指定网络端口发送命令执行请求;
    所述网页接收相应的应用通过所述指定网络端口接收到所述命令执行请求后,执行相应的操作并返回的操作结果。
  2. 如权利要求1所述的方法,其中,
    所述命令执行请求为HTTP请求,包括:所述指定网络端口的端口号、要执行的命令和执行命令的应用的标识。
  3. 如权利要求1所述的方法,其中,
    所述命令执行请求中还包括:JS回调函数;
    所述网页接收通过JS回调函数返回的所述操作结果。
  4. 如权利要求1所述的方法,其中,该方法进一步包括:
    所述网页展示所述操作结果。
  5. 如权利要求1所述的方法,其中,所述终端设备上的网页向所述终端设备的指定网络端口发送命令执行请求包括:
    所述终端设备上的网页,在特定的网页场景下,自动向所述指定网络端口发送命令执行请求;
    或者,
    所述终端设备上的网页,当网页显示界面上的特定控件被触发时,向所述指定网络端口发送命令执行请求。
  6. 如权利要求2中所述的方法,其中,
    所述命令执行请求中还包括:所述网页的描述信息;
    则该方法在所述终端设备上的网页向所述终端设备的指定网络端口发送命令执行请求之后,进一步包括:
    所述网页接收所述命令执行请求中包含的应用的标识对应的应用返回的,表示拒绝执行的反馈消息;
    所述网页接收到所述反馈消息后,向所述终端设备的指定网络端口发送包含能够执行相应命令的其他应用的标识的命令执行请求。
  7. 如权利要求1-6中任一项所述的方法,其中,所述终端设备上的网页向所述终端设备的指定网络端口发送命令执行请求包括:
    所述终端设备上的网页,向能够执行相应命令的应用所对应的指定网络端口发送命令执行请求;
    其中,存在约定好的一个或者多个指定网络端口;如存在多个指定网络端口,不同的网络端口对应不同分类的应用。
  8. 如权利要求1-6中任一项所述的方法,其中,在终端设备上的网页向所述终端设备的指定网络端口发送命令执行请求之前,该方法进一步包括:
    所述终端设备上的网页展示能够执行相应命令的多个应用的标识供用户进行选择,并接收用户的选择结果;
    所述终端设备上的网页向所述终端设备的指定网络端口发送命令执行请求包括:所述终端设备上的网页向用户选择的应用所对应的指定网络端口,发送包含用户选择的应用的标识的命令执行请求。
  9. 一种实现终端设备上的网页和应用间通信的方法,其中,该方法包括:
    终端设备上的应用监听所述终端设备的指定网络端口,通过所述指定网络端口接收所述终端设备上的网页发送的命令执行请求;
    所述应用根据所述命令执行请求执行相应的操作,将操作结果返回给所述网页。
  10. 如权利要求9所述的方法,其中,
    所述命令执行请求为HTTP请求,包括:所述指定网络端口的端口号、要执行的命令和执行命令的应用的标识;
    所述通过所述指定网络端口接收所述终端设备上的网页发送的命令执行请求包括:所述应用通过所述指定网络端口接收包含本应用的标识的命令执行请求。
  11. 如权利要求9所述的方法,其中,
    所述命令执行请求中还包括:JS回调函数;
    所述将操作结果返回给所述网页包括:将操作结果通过JS回调函数返回给所述网页。
  12. 如权利要求9所述的方法,其中,
    所述终端设备上的应用监听所述终端设备的指定网络端口包括:所述应用中有一个随所述终端设备的启动而启动的第一服务,由该第一服务来监听所述指定网络端口。
  13. 如权利要求12所述的方法,其中,
    所述应用根据所述命令执行请求执行相应的操作包括:由所述应用中的第二服务根据所述命令执行请求执行相应的操作;
    其中,所述第一服务和第二服务为同一个服务或者为独立的两个服务。
  14. 如权利要求10所述的方法,其中,
    所述命令执行请求中还包括:所述网页的描述信息;
    该方法在所述应用根据所述命令执行请求执行相应的操作之前,进一步包括:
    根据所述网页的描述信息判断是否执行所述命令执行请求的相应操作,是则所述应用根据所述命令执行请求执行相应的操作,将操作结果返回给所述网页,否则所述应用向所述网页返回表示拒绝执行的反馈消息。
  15. 如权利要求9-14中任一项所述的方法,其中,
    所述终端设备上的应用监听所述终端设备的指定网络端口包括:所述终端设备上的应用监听所述终端设备的与自身对应的指定网络端口;
    其中存在约定好的一个或者多个指定网络端口;如存在多个指定网络端口,不同的网络端口对应不同分类的应用。
  16. 一种实现终端设备上的网页和应用间通信的网页端装置,其中,该网页端装置包括:
    命令发送单元,适于向所述终端设备的指定网络端口发送命令执行请求;
    操作结果接收单元,适于接收相应的应用通过所述指定网络端口接收到所述命令执行请求后,执行相应的操作并返回的操作结果。
  17. 如权利要求16所述的网页端装置,其中,
    所述命令发送单元发送的所述命令执行请求为HTTP请求,包括:所述指定网络端口的端口号、要执行的命令和执行命令的应用的标识。
  18. 如权利要求16述的网页端装置,其中,
    所述命令发送单元发送的所述命令执行请求中还包括:JS回调函数;
    所述操作结果接收单元,适于接收通过JS回调函数返回的所述操作结果。
  19. 如权利要求16所述的网页端装置,其中,该网页端装置进一步包括:
    展示单元,适于展示所述操作结果。
  20. 如权利要求16所述的网页端装置,其中,
    所述命令发送单元,适于在特定的网页场景下,自动向所述指定网络端口发送命令执行请求;或者,适于在网页显示界面上的特定控件被触发时,向所述指定网络端口发送命令执行请求。
  21. 如权利要求17中所述的网页端装置,其中,
    所述命令发送单元发送的所述命令执行请求中还包括:网页的描述信息;
    所述命令发送单元,进一步适于接收所述命令执行请求中包含的应用的标识对应的应用返回的,表示拒绝执行的反馈消息;以及适于在接收到所述反馈消息后,向所述终端设备的指定网络端口发送包含能够执行相应命令的其他应用的标识的命令执行请求。
  22. 如权利要求16-21中任一项所述的网页端装置,其中,
    所述命令发送单元,适于向能够执行相应命令的应用所对应的指定网络端口发送命令执行请求;
    其中,存在约定好的一个或者多个指定网络端口;如存在多个指定网络端口,不同的网络端口对应不同分类的应用。
  23. 如权利要求16-21中任一项所述的网页端装置,其中,该网页端装置进一步包括:
    应用选择单元,适于展示能够执行相应命令的多个应用的标识供用户进行选择,接收用户的选择结果并发送给命令发送单元;
    所述命令发送单元,适于向用户选择的应用所对应的指定网络端口,发送包含用户选择的应用的标识的命令执行请求。
  24. 一种实现终端设备上的网页和应用间通信的应用端装置,其中,该应用端装置包括:
    监听单元,适于监听所述终端设备的指定网络端口,通过所述指定网络端口接 收所述终端设备上的网页发送的命令执行请求;
    执行单元,适于根据所述命令执行请求执行相应的操作,将操作结果返回给所述网页。
  25. 如权利要求24所述的应用端装置,其中,
    所述监听单元接收的所述命令执行请求为HTTP请求,包括:所述指定网络端口的端口号、要执行的命令和执行命令的应用的标识;
    所述监听单元,适于通过所述指定网络端口接收包含与本应用端装置对应的应用标识的命令执行请求。
  26. 如权利要求24所述的应用端装置,其中,
    所述监听单元接收的所述命令执行请求中还包括:JS回调函数;
    所述执行单元,适于将操作结果通过JS回调函数返回给所述网页。
  27. 如权利要求24所述的应用端装置,其中,
    所述监听单元,适于随所述终端设备的启动而启动,启动后即监听所述指定网络端口。
  28. 如权利要求27所述的应用端装置,其中,
    所述监听单元和所述执行单元运行在同一个服务中,或者运行在独立的两个服务中。
  29. 如权利要求25所述的应用端装置,其中,
    所述监听单元接收的所述命令执行请求中还包括:网页的描述信息;
    所述执行单元,在根据所述命令执行请求执行相应的操作之前,进一步适于根据所述网页的描述信息判断是否执行所述所述命令执行请求的相应操作,是则根据所述命令执行请求执行相应的操作,将操作结果返回给所述网页,否则向所述网页返回表示拒绝执行的反馈消息。
  30. 如权利要求24-29中任一项所述的应用端装置,其中,
    所述监听单元,适于监听所述终端设备的与本应用端装置对应的指定网络端口;
    其中存在约定好的一个或者多个指定网络端口;如存在多个指定网络端口,不同的网络端口对应不同分类的应用端装置。
  31. 一种实现终端设备上的网页和应用间通信的系统,其中,该系统包括:如权利要求16-23中任一项所述的网页端装置,以及一个或多个如权利要求24-30中任一项所述的应用端装置。
  32. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在计算设备上运行时,导致所述计算设备执行根据权利要求1至15任一项所述的实现终端设备上的网页和应用间通信的方法。
  33. 一种计算机可读介质,其中存储了如权利要求32所述的计算机程序。
PCT/CN2015/090823 2014-11-06 2015-09-25 实现终端设备上的网页和应用间通信的方法、装置和系统 WO2016070690A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410637090.5A CN104375831B (zh) 2014-11-06 2014-11-06 实现终端设备上的网页和应用间通信的方法、装置和系统
CN201410637090.5 2014-11-06

Publications (1)

Publication Number Publication Date
WO2016070690A1 true WO2016070690A1 (zh) 2016-05-12

Family

ID=52554774

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/090823 WO2016070690A1 (zh) 2014-11-06 2015-09-25 实现终端设备上的网页和应用间通信的方法、装置和系统

Country Status (2)

Country Link
CN (1) CN104375831B (zh)
WO (1) WO2016070690A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106919413A (zh) * 2015-12-25 2017-07-04 北京奇虎科技有限公司 一种通过网页调用应用程序app的方法和装置

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104375831B (zh) * 2014-11-06 2018-04-20 北京奇虎科技有限公司 实现终端设备上的网页和应用间通信的方法、装置和系统
CN107291741B (zh) * 2016-03-31 2021-05-11 创新先进技术有限公司 通信方法和装置
CN107193667B (zh) * 2017-04-25 2021-03-09 北京小米移动软件有限公司 网页权限的更新方法及装置
CN110990170A (zh) * 2019-11-29 2020-04-10 广州市百果园信息技术有限公司 数据结构、通信方法、装置、存储介质及设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103279706A (zh) * 2013-06-07 2013-09-04 北京奇虎科技有限公司 拦截在移动终端中安装安卓应用程序的方法和装置
KR20140125255A (ko) * 2013-04-18 2014-10-28 주식회사 지어소프트 셋톱박스를 이용한 어플리케이션의 업데이트 시스템 및 방법
CN104123163A (zh) * 2014-07-30 2014-10-29 珠海市君天电子科技有限公司 一种应用程序的下载请求的处理方法及装置
CN104375831A (zh) * 2014-11-06 2015-02-25 北京奇虎科技有限公司 实现终端设备上的网页和应用间通信的方法、装置和系统

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103049320B (zh) * 2012-12-17 2016-05-04 广州市动景计算机科技有限公司 在浏览器中启动外部应用程序的方法和装置
CN103279375B (zh) * 2013-06-19 2016-08-10 百度在线网络技术(北京)有限公司 在浏览器中运行应用程序的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20140125255A (ko) * 2013-04-18 2014-10-28 주식회사 지어소프트 셋톱박스를 이용한 어플리케이션의 업데이트 시스템 및 방법
CN103279706A (zh) * 2013-06-07 2013-09-04 北京奇虎科技有限公司 拦截在移动终端中安装安卓应用程序的方法和装置
CN104123163A (zh) * 2014-07-30 2014-10-29 珠海市君天电子科技有限公司 一种应用程序的下载请求的处理方法及装置
CN104375831A (zh) * 2014-11-06 2015-02-25 北京奇虎科技有限公司 实现终端设备上的网页和应用间通信的方法、装置和系统

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106919413A (zh) * 2015-12-25 2017-07-04 北京奇虎科技有限公司 一种通过网页调用应用程序app的方法和装置

Also Published As

Publication number Publication date
CN104375831B (zh) 2018-04-20
CN104375831A (zh) 2015-02-25

Similar Documents

Publication Publication Date Title
WO2016070690A1 (zh) 实现终端设备上的网页和应用间通信的方法、装置和系统
US9697353B2 (en) Method and device for intercepting call for service by application
JP6686165B2 (ja) サービス実行方法及びデバイス
CN110780930B (zh) 启动Android系统的方法、装置、电子设备及存储介质
WO2019157860A1 (zh) 应用界面的启动方法、装置、存储介质及电子设备
EP4220402A2 (en) Augmenting capabilities of a host device
CN106027631B (zh) 一种数据传输方法及装置
WO2020216204A1 (zh) 信息获取方法和装置
EP2901660A1 (en) Termininal interaction methods and related devices and systems
CN110244963B (zh) 数据更新方法、装置及终端设备
TWI671680B (zh) 一種應用的操作方法及裝置
WO2015127842A1 (zh) 信息安全设备实现多应用的方法、信息安全设备和系统
US20140282057A1 (en) System for applying applications of different operating systems in one electronic device and method thereof
WO2016169426A1 (zh) 一种视频播放方法及装置
CN104751046B (zh) 一种应用程序的用户认证方法及移动终端设备
WO2014067368A1 (zh) 资源预览图的获取方法、装置以及设备
US20240012677A1 (en) Pre-launching an application using interprocess communication
US20210043214A1 (en) Programmable Voice Extension Framework
KR102052651B1 (ko) 데이터 접근 제어 방법 및 그 전자 장치
US20160196423A1 (en) Smart device and method for dynamically detecting applications
EP2768206B1 (en) Download management method and device based on android browser
CN115344471A (zh) 用户界面的测试方法、系统、集群、介质及程序产品
CN113064673A (zh) 一种多应用环境的配置方法、装置、设备及介质
CN107567627B (zh) 具有测试执行环境的装置
CN111831530A (zh) 测试方法和装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15857625

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15857625

Country of ref document: EP

Kind code of ref document: A1