WO2014059930A1 - 浏览器中的消息发送设备和接收设备及方法和系统 - Google Patents

浏览器中的消息发送设备和接收设备及方法和系统 Download PDF

Info

Publication number
WO2014059930A1
WO2014059930A1 PCT/CN2013/085316 CN2013085316W WO2014059930A1 WO 2014059930 A1 WO2014059930 A1 WO 2014059930A1 CN 2013085316 W CN2013085316 W CN 2013085316W WO 2014059930 A1 WO2014059930 A1 WO 2014059930A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
web page
browser
source
attribute value
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.)
Ceased
Application number
PCT/CN2013/085316
Other languages
English (en)
French (fr)
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.)
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Publication of WO2014059930A1 publication Critical patent/WO2014059930A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

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]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/08Annexed information, e.g. attachments
    • 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/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Definitions

  • the present invention relates to the field of network technologies, and in particular, to a message transmitting device and method in a browser, a message receiving device and method, and a communication system and method in a browser. Background technique
  • HTML5 technology is a set of technologies including past HTML, CSS and JavaScr ipt.
  • JavaScr ipt is a front-end dynamic scripting technology that is often used in web development.
  • JavaScr ipt there is a four-fold security limitation called "Same-Or i gin Pol icy". This strategy imposes an important limitation on the content of pages that JavaScr ipt code can access, that is, JavaScr ipt can only access content that is in the same domain as the document containing it.
  • the JavaScr ipt security policy is especially important when doing multiple if rame or multi-window programming, as well as Ajax programming.
  • the JavaScr ipt code contained in the page under the ba idu. com domain name cannot access the page content under the domain name of goog le, com; even the pages between different subdomains cannot be mutually encoded by JavaScr ipt code. access.
  • the effect on Ajax is that Ajax requests implemented via XMLHt tpReques t cannot submit requests to different domains. For example, on abc. exampl e, com pages, you cannot submit Ajax requests to def. exampl e, com, etc. .
  • HTML5 introduces a new inter-domain messaging mechanism pos tMes sage, which allows communication between multiple if rame or window in the page.
  • Some browsers introduce this inter-domain messaging mechanism into the browser even if HTML5 is not yet supported.
  • not all browsers currently support the HTML5 standard.
  • IE6 and IE7 not only do not support HTML5, but also do not support such inter-domain messaging mechanisms. Therefore, the pos tMes sage message transmission mechanism cannot be used by IE6 and IE7, which occupy a large market share, for cross-domain communication.
  • a message transmitting apparatus that transmits a message from a source web page to a target web page in a browser.
  • the message sending device includes a custom message sender that transmits a message of the source web page to be sent to the target web page by modifying a specific attribute value of the target web page.
  • a message sending method for transmitting a message from a source webpage to a target webpage in a browser, the message sending method comprising the steps of: sending a specific attribute value of the target webpage to be sent The source web page message is sent to the target web page.
  • the present invention provides a message receiving device that receives a message from a source webpage from a target webpage in a browser, the message receiving apparatus comprising: a custom message receiver that periodically checks a specificity of the target webpage Whether the attribute value changes, if the specific attribute value changes, the specific attribute value is processed to obtain a message from the source web page.
  • the present invention provides a message receiving method for causing a target webpage in a browser to receive a message from a source webpage, the message receiving method comprising the steps of: periodically checking whether a specific attribute value of the target webpage changes. If a particular attribute value changes, the particular attribute value is processed to obtain a message from the source web page.
  • the present invention provides a browser communication system for communication between a source webpage and a target webpage, wherein the source webpage and the target webpage respectively include the message transmitting apparatus of the present invention described above; And the message receiving apparatus of the present invention as described above.
  • the present invention provides a communication method of a browser for communication between a source webpage and a target webpage, the communication method comprising: the foregoing message transmitting method of the present invention; The message receiving method of the present invention is described.
  • a browser that does not support the inter-domain message transmission mechanism proposed by the HTML5 standard can also implement cross-domain communication.
  • the present invention is relatively secure, can transfer a large number of data types, and uses a cartridge.
  • FIG. 1 shows a block diagram of a message transmitting device in a browser according to an embodiment of the present invention
  • Figure 2 is a flow chart showing a message transmitting method of a browser according to an embodiment of the present invention
  • Figure 3 is a block diagram showing a message receiving device in a browser according to an embodiment of the present invention
  • FIG. 5 is a block diagram showing a communication system of a browser according to an embodiment of the present invention
  • FIG. 6 is a flowchart showing a communication method of a browser according to an embodiment of the present invention
  • FIG. 8 shows a schematic diagram of a storage unit for holding or carrying program code implementing the method according to the present invention.
  • the message transmitting apparatus 100 includes a first determiner 110, a standard message transmitter 120, and a custom message transmitter 130.
  • the first determiner 110 determines if the browser supports an inter-domain messaging mechanism, such as HTML5. When it is determined that the browser supports the inter-domain message transmission mechanism, the message of the source webpage to be sent is transmitted to the standard message sender 120; when the first determiner 110 determines that the current browser does not support the inter-domain message transmission mechanism, it will send The message of the source web page is transmitted to the custom message sender 130.
  • an inter-domain messaging mechanism such as HTML5.
  • the standard message sender 120 transmits a message of the source web page to be sent to the target web page by means of message transmission between the domains.
  • HTML5 sends a message in the same way as the pos tMes sage application.
  • the standard message sender 120 can use the following code:
  • windowOb jec t represents the window object of the target web page
  • data represents the information to be sent by the source web page, and can directly call pos tMes sage to send the message.
  • the custom message sender 130 sends a message of the source web page to be sent to the target web page by modifying the specific attribute value of the target web page.
  • the specific attribute value indicating the inter-domain message transmission may be the name attribute value of the wi ndow object or the attribute value of the other attribute, or may be the attribute value of two or more attributes.
  • - - Take the javascr ipt code as an example. If you need to send a message to the target web page, the custom message sender 130 can use the following code:
  • w i ndowOb j ec t represents the window object of the target webpage
  • da t a represents the information to be sent by the source webpage
  • the custom message generator 130 implements the message transmission by modifying the name attribute value of the target page window object to be a message to be sent.
  • the message transmitting device 100 in the browser shown in FIG. 1 above can be used in the case where the source web page and the target web page are located in the same URL domain, and can be used in the case where the source web page and the target web page are located in different URL domains.
  • the source webpage and the target webpage may be different webpages located in the same domain abc. example, com, or the source webpage may be a webpage located at abc. example, com and the target webpage is a webpage located at def. example, com.
  • the message transmitting device 100 in the browser of FIG. 1 may include only the customized message transmitter 130.
  • the landing page supports inter-domain messaging, such as HTML5.
  • the custom message sender 130 sends a message to the target web page by modifying the specific attribute value of the target web page (e.g., the value of the window object's name attribute).
  • step S210 determines whether the browser supports an inter-domain message transmission mechanism, such as HTML5.
  • step S220 determines whether the message of the source webpage to be sent is sent to the target webpage by the message sending manner of the inter-domain.
  • the source web page can send a message to the target web page in the same way as the pos tMes sage application.
  • step S210 When it is determined in step S210 that the current browser does not support the inter-domain message transmission mechanism, the method proceeds to step S230, in which the message of the source web page to be transmitted is transmitted to the target web page by modifying the specific attribute value of the target web page.
  • the specific attribute value of the target web page can be the value of the name attribute of the window object or the attribute value of other attributes, or the attribute value of two or more attributes.
  • the source webpage and the target webpage may be located in the same URL domain or in different URL domains.
  • the two can be located in different pages in the same domain abc.
  • the source webpage is a webpage located in abc.
  • com and the target webpage is a webpage located in def. examp le, com.
  • the message sending method in the browser shown in FIG. 2 may only include the step of: sending a message of the source webpage to be sent to the target webpage by modifying a specific attribute value of the target webpage.
  • the message of the source webpage is sent to the target webpage by modifying the specific attribute value of the target webpage.
  • FIG. 3 shows a block diagram of a message receiving device 300 in a browser in accordance with an embodiment of the present invention.
  • the message receiving device 300 causes the target web page to receive a message from the source web page.
  • the message receiving device 300 includes a second determiner 310, a standard message receiver 320, and a custom message receiver 330.
  • the second determiner 31 0 determines whether the browser supports the inter-domain message transmission mechanism. When the second determiner 310 determines that the browser supports the inter-domain message transmission mechanism, the message from the source page is received by the standard message receiver 320; when the second determiner 310 determines that the current browser does not support the inter-domain message transmission mechanism The custom message receiver 330 receives the message from the source page.
  • the standard message receiver 320 receives the message from the source web page in a manner of receiving messages between the domains. For example, if the source web page and the target web page support inter-domain message transmission, the standard message receiver 320 can receive the message from the source web page in a manner corresponding to pos tMes sage.
  • wan360. xdoma in. hand er is a function to process the received message.
  • the corresponding event is triggered (depending on the browser version, possibly a message event or an onmes sage event), by registering wan360. xdoma in. hand er
  • the web page receives the message
  • the corresponding event is triggered, and the wan360. xdoma in. hand monitor that monitors the event receives the message and processes it.
  • the custom message receiver 330 periodically checks if the particular attribute value of the target web page has changed, and if the particular attribute value changes, processes the particular attribute value to obtain a message from the source web page.
  • the specific attribute value of the webpage may be the value of the name attribute of the window object or the attribute value of the other attribute, or may be the attribute value of two or more attributes.
  • Hash window, name; - - cb (hash) ;
  • cb is a function that processes the message. It periodically checks whether the name value of the window object changes or is empty. When the name value changes, it indicates that the message was received. At this time, the message can be processed by cb. Message.
  • the message receiving device 300 shown in FIG. 3 may further include a message processing device (such as cb in the above example) that processes messages from the source web page received by the standard message receiver 320 and the customized message receiver 330.
  • a message processing device such as cb in the above example
  • the message processing device can also be set independently of the message receiving device 300.
  • the standard message receiving device 320 includes: a listener 3210 that listens for messages from the source web page; and a trigger 3220 that triggers and receives the message when there is a message from the source web page.
  • the custom message receiver 330 includes a timer 3310 that periodically checks if the particular attribute value of the target web page has changed and is not empty.
  • the message receiving device 300 in the browser shown in FIG. 3 above can be used in the case where the source web page and the target web page are located in the same URL domain, or in the case where the source web page and the target web page are located in different URL domains.
  • the source web page and the target web page may be different web pages located in the same domain abc. examp le, com, or the source web page may be located at abc. examp le, com and the target web page is located at def. examp le, com Web page.
  • the message receiving device 300 in the browser shown in FIG. 3 may include only the customized message receiver 330.
  • the custom message receiver 330 periodically checks whether the specific attribute value of the target web page changes. If the specific attribute value changes, the specific attribute value is processed to obtain the source. Web page message.
  • step S410 it is determined whether the browser supports an inter-domain message transmission mechanism, such as whether HTML5 is supported.
  • step S420 is performed to receive the message from the source webpage in the message receiving manner between the domains.
  • the target web page can receive messages from the source web page in a manner corresponding to the Post Messa ge application.
  • step S41 if it is determined that the current browser does not support the inter-domain message transmission mechanism, the method proceeds to step S430, where it is periodically checked whether the specific attribute value of the target webpage changes, and if the specific attribute value changes, the processing is performed.
  • the specific attribute value of the webpage may be a name attribute value of the window object or an attribute value of another attribute, or may be an attribute value of two or more attributes.
  • the message receiving method 400 may further include a step S440, in which the received message from the source webpage is processed, for example, after the step S420 or the step S430. Displayed on the landing page. Then, it ends with step S445.
  • the message receiving method in the browser shown in FIG. 4 above can be used for the case where the source webpage and the target webpage are located in the same URL domain, and can also be used in the case where the source webpage and the target webpage are located in different URL domains.
  • the source webpage and the target webpage may be different webpages located in the same domain abc. examp le, com, or the source webpage is a webpage located at abc. examp l e. com and the 3 webpage is located at def. examp le, Com's webpage.
  • Figure 5 shows a block diagram of a communication system 500 of a browser for communication between a source web page and a target web page, in accordance with an embodiment of the present invention.
  • the communication system 500 of the browser of the present invention includes the message transmitting device 100 shown in FIG. 1 and the message receiving device 300 shown in FIG.
  • the message transmitting device 100 includes the first determiner 110, the standard message transmitter 120, and the custom message sender 1 30 shown in FIG.
  • the message receiving device 300 includes the second determiner 310, the standard message receiver 320, and the customized message receiver 330 shown in FIG.
  • the first determiner 110 in the message transmitting device 100 determines whether the browser supports an inter-domain message transmission mechanism such as HTML5. When it is determined that the browser supports the inter-domain message transmission mechanism, the message of the source web page to be transmitted is transmitted to the standard message transmitter 120.
  • the standard message sender 120 transmits the message of the source web page to the second determiner 310 of the message receiving device 300 in the manner of message transmission between the domains.
  • the second determiner 31 0 determines whether the browser supports the inter-domain message transmission mechanism. When it is determined that the browser supports the inter-domain message transmission mechanism, the message from the source page is received by the standard message receiver 320.
  • the message of the source web page to be transmitted is transmitted to the custom message sender 1 30.
  • the custom message sender 1 30 transmits a message of the source web page to be transmitted to the second determiner 310 of the message receiving device 300 by modifying the specific attribute value of the target web page, and the second determiner 310 determines whether the browser supports inter-domain message transmission.
  • the mechanism when it is determined that the browser does not support the inter-domain message transmission mechanism, the customized message receiver 330 periodically checks whether the specific attribute value of the target webpage changes. If the specific attribute value changes, the specific attribute value is processed to obtain the Source web page message.
  • the communication system of the browser of the present invention may further include a message processor 510.
  • Message processor 510 processes the messages received by standard message receiver 320 or customized message receiver 330.
  • the communication system 500 of the browser of the present invention can be used for both the source web page and the target web page being located in the same
  • the case of the URL field can be used in the case where the source web page and the target web page are located in different URL domains.
  • the source web page and the target web page may be different web pages located in the same domain abc. examp le, com, or the source web page may be located at abc. examp le, com and the target webpage is located at def. examp le, com Web page.
  • the message transmitting device 100 in the communication system 500 of the browser of the present invention may include only the customized message sender 130, and accordingly, the message receiving device 300 may include only the customized message sender 330.
  • the customized message sender 130 sends a message of the source webpage to be sent to the specific attribute value of the target webpage (for example, the name attribute value of the window object).
  • the target web page accordingly, the custom message receiver 330 periodically checks whether the specific attribute value of the target web page has changed. If the specific attribute value changes, the specific attribute value is processed to obtain a message from the source web page.
  • the communication system 500 of the browser of the present invention may be as described above, wherein the message sending device 100 is disposed in the source webpage, and the message receiving device 300 is disposed in the target webpage, so that the target webpage is always acceptable from the source webpage.
  • the communication system 500 of the browser of the present invention is not limited thereto, and both the source webpage and the target webpage may include both the message sending device 100 and the message receiving device 300, so that any one webpage can both send and receive messages. Message.
  • the communication system 500 of the browser of the present invention will now be described in more detail by way of a specific example.
  • the communication system 500 of the browser of the present invention places a web page parent located in the first domain a.com with the web page chi ld, html in the second domain b. com embedded by the if rame Cross-domain communication.
  • the webpage parent, html in the first domain is the source webpage, and the webpage chi ld, html in the second domain is called the target webpage.
  • the web page parent, html in the first domain has a messaging device 100 that is responsible for sending messages to the target web page via sendMes sage.
  • the web page chi ld. html in the second domain has a message receiving device 300 and a message processor 510.
  • the message receiving device 300 is responsible for receiving the message sent by the source web page by listening and handing the message to the message processor 510 for processing.
  • the message transmitting device 100 has a first determiner 110, a standard message sender 120, and a custom message sender 130.
  • the first determiner 110 determines whether the browser supports HTML5, such as Fi refox, IE8+, Opera, Safar i, Chrome is an HTML5-capable browser, and IE6 and IE7 are browsers that do not support HTML5.
  • the standard message sender 120 sends the message to the target webpage through the POS tMes sage function of HTML5. Otherwise, the custom message sender 130 sends a message to the target webpage by modifying the name attribute of the window object in the target webpage. .
  • the message receiving device 300 includes a second determiner 310, a standard message receiver 320, and a custom message receiver 330.
  • the second determiner 310 determines whether the browser supports HTML5. If it is determined that the browser supports HTML5, the BJ standard message receiver 320 adds a message listening event by using addEventL is tener or at tachEvent (depending on browser support case selection), for example.
  • the source webpage message is an event, and the message delivered by the source webpage is obtained by the event triggering, and then the message is forwarded to the message processor 510 for processing; otherwise, the custom message receiver 330 will periodically detect the name attribute of the window object of the target webpage.
  • the present invention also provides a flowchart of a communication method 600 for a browser according to an embodiment of the present invention, as shown in FIG. 6, for communication between a source web page and a target web page.
  • the communication method of the browser is as in step S605, and then the message transmitting method shown in Fig. 2 is executed, and then the message receiving method shown in Fig. 4 is executed, and then the communication method is ended in step S665.
  • the foregoing message sending method refer to the foregoing description about FIG. 2.
  • the foregoing message receiving method refer to the foregoing description about FIG. 4, and the description is not repeated here.
  • the present invention in order to implement cross-domain communication between a web page of an HTML5 browser (hereinafter referred to as "source web page”) and a web page of a different domain embedded by an if rame (hereinafter referred to as "target web page”), first determines whether the target web page supports HTML5. If HTML5 is supported, the HTML5 message sending method, that is, the pos tMes sage application, is used for communication. If HTML5 is not supported, the message is sent by modifying the name attribute of the target web window object. The target webpage determines whether to receive the message by judging whether the value of the name attribute of the window object changes or is empty, thereby realizing cross-domain communication between web pages of different domains.
  • 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.
  • All of the features disclosed in this specification, including the accompanying claims, the abstract and the drawings, and all the processes or elements of any of the methods or devices disclosed herein may be combined in any combination.
  • Each feature disclosed in the 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 or all of the functionality of some or all of the components in accordance with embodiments of the present invention.
  • 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.
  • a program implementing the present 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 7 illustrates an intelligent electronic device that can implement a user request processing method in accordance with the present invention.
  • the intelligent electronic device conventionally includes a processor 710 and a computer program product or computer readable medium in the form of a memory 720.
  • Memory 720 can be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk or ROM.
  • Space 730 can include various program code 731 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.
  • These 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 Figure 8.
  • the storage unit may have a storage section or a storage space or the like arranged similarly to the storage 720 in the intelligent electronic device of Fig. 7.
  • the program code may, for example, be executed in a suitable form, i.e., code that may be sold by a processor such as 710, which when executed by the intelligent electronic device causes the intelligent electronic device to perform various steps in the methods described above. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明公开了一种浏览器中的消息发送设备,其包括:标准消息发送器,其通过网域间消息发送方式将要发送的源网页的消息发送给目标网页;第一判定器,其判定浏览器是否支持网域间消息传输机制,当判定浏览器支持网域间消息传输机制时,将要发送的源网页的消息传送至标准消息发送器,当第一判定器判定当前浏览器不支持网域间消息传输机制时,将要发送的源网页的消息传送至定制消息发送器;以及定制消息发送器,其通过修改目标网页的特定属性值而将要发送的源网页的消息发送给目标网页。另外,本发明还提供一种消息发送方法。相应地,本发明还提供一种消息接收设备及方法、一种浏览器的通信系统及方法。

Description

一 一 浏览器中的消息发送设备和接收设备及方法和系统 技术领域
本发明涉及网络技术领域,具体涉及一种在浏览器中的消息发送设备及方 法、 消息接收设备及方法、 以及在浏览器的通信系统及方法。 背景技术
如今,为了强化 Web网页的表现性能,许多浏览器已经开始采用 HTML5技术。 HTML5技术是包括以往的 HTML、 CSS和 JavaScr ipt在内的一套技术组合。
JavaScr ipt是一种在 Web开发中经常使用的前端动态脚本技术。 在
JavaScr ipt中, 有一个 4艮重要的安全性限制, 被称为 "Same-Or i gin Pol icy" (同源策略)。这一策略对于 JavaScr ipt代码能够访问的页面内容做了很重要 的限制, 即 JavaScr ipt只能访问与包含它的文档在同一域下的内容。
JavaScr ipt这个安全策略在进行多 if rame或多窗口编程、以及 Ajax编程时 显得尤为重要。 根据这个策略, 例如在 ba idu. com域名下的页面中包含的 JavaScr ipt代码, 不能访问在 goog le, com域名下的页面内容; 甚至不同的子域 名之间的页面也不能通过 JavaScr ipt代码互相访问。对于 Ajax的影响在于, 通 过 XMLHt tpReques t实现的 Ajax请求, 不能向不同的域提交请求, 例如, 在 abc. exampl e, com下的页面, 不能向 def. exampl e, com提交 Ajax请求, 等等。
然而, 当进行一些比较深入的前端编程的时候, 不可避免地需要进行跨域 操作, 这时候 "同源策略" 就显得过于苛刻。
目前, HTML5为了解决跨域通信问题, 引入了一个新的网域间消息传输机 制 pos tMes sage, pos tMes sage允许页面中的多个 if rame或 window之间的通信。 一些浏览器即使还不支持 HTML5 , 但是也将这种网域间消息传输机制引入到浏 览器中。 然而, 当前并不是所有的浏览器都支持 HTML5标准, 例如 IE6和 IE7等 不仅不支持 HTML5 , 而且也不支持这种网域间消息传输机制。 因此 pos tMes sage 消息传输机制不能由占不小市场份额的 IE6、 IE7采用来进行跨域通信。
因此,需要一种能够考虑到浏览器的不兼容性而可靠地进行网页跨域通信 的技术。 发明内容
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地 解决上述问题的消息发送设备及方法、 消息接收设备及方法、和浏览器的通信 系统及通信方法。 - - 依据本发明的一个方面,提供了一种消息发送设备,其在浏览器中将来自 源网页的消息向目标网页发送。该消息发送设备包括定制消息发送器, 该定制 消息发送器通过修改目标网页的特定属性值而将要发送的源网页的消息发送 给目标网页。
根据本发明的另一方面,提供了一种消息发送方法,其在浏览器中将来自 源网页的消息向目标网页发送, 该消息发送方法包括步骤: 通过修改目标网页 的特定属性值而将要发送的源网页的消息发送给目标网页。
根据本发明的又一方面,本发明提供一种消息接收设备,其在浏览器中从 目标网页接收来自源网页的消息, 该消息接收设备包括: 定制消息接收器, 其 定时检查目标网页的特定属性值是否发生变化, 如果所述特定属性值发生变 化, 则处理该特定属性值以获得来自源网页的消息。
根据本发明的又一方面,本发明提供一种消息接收方法,其使浏览器中的 目标网页接收来自源网页的消息, 该消息接收方法包括步骤: 定时检查目标网 页的特定属性值是否发生变化,如果特定属性值发生变化, 则处理该特定属性 值以获得来自源网页的消息。
根据本发明的又一方面,本发明提供一种浏览器的通信系统, 其用于源网 页与目标网页之间的通信,其中源网页和目标网页分别包括前面所述本发明的 消息发送设备; 以及前面所述的本发明的消息接收设备。
根据本发明的再一方面,本发明提供一种浏览器的通信方法, 其用于源网 页与目标网页之间的通信, 该通信方法包括: 前面所述的本发明的消息发送方 法; 以及前面所述的本发明的消息接收方法。
利用本发明, 可以使得不支持 HTML5标准所提出的网域间消息传输机制的 浏览器也能够实现跨域通信。另外,本发明比较安全、可以传输大量数据类型, 并且使用筒单。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术 手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、 特征和优点能够更明显易懂, 以下特举本发明的具体实施方式。 附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领 域普通技术人员将变得清楚明了。 附图仅用于示出优选实施方式的目的, 而并 不认为是对本发明的限制。 而且在整个附图中, 用相同的参考符号表示相同的 部件。 在附图中:
图 1示出了根据本发明一种实施方式的浏览器中的消息发送设备的框图; - - 图 2示出了根据本发明一种实施方式的浏览器的消息发送方法的流程图; 图 3示出了根据本发明一种实施方式的浏览器中的消息接收设备的框图; 图 4示出了根据本发明的一种实施方式的浏览器的消息接收方法的流程 图;
图 5示出了根据本发明的一种实施方式的浏览器的通信系统的框图; 以及 图 6示出了根据本发明的一种实施方式的浏览器的通信方法的流程图; 图 7示出了用于执行根据本发明的方法的智能电子设备的框图; 以及 图 8示出了用于保持或者携带实现根据本发明的方法的程序代码的存 储单元示意图。 具体实施方式
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了 本公开的示例性实施例, 然而应当理解, 可以以各种形式实现本公开而不应被 这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本 公开, 并且能够将本公开的范围完整的传达给本领域的技术人员。
下面结合附图具体介绍本发明。
图 1示出了根据本发明的一种实施方式的浏览器中的消息发送设备的框 图。 该消息发送设备用于将源网页的消息向目标网页发送。 如图 1所示, 消息 发送设备 100包括第一判定器 110、标准消息发送器 120、和定制消息发送器 130。
第一判定器 110判定浏览器是否支持网域间消息传输机制, 例如 HTML5。 当 判定浏览器支持网域间消息传输机制时,将要发送的源网页的消息传送至标准 消息发送器 120;当第一判定器 110判定当前浏览器不支持网域间消息传输机制 时, 将要发送的源网页的消息传送至定制消息发送器 130。
标准消息发送器 120通过网域间的消息发送方式将要发送的源网页的消息 发送给目标网页。例如, HTML5采取 pos tMes sage应用的方式发送消息。以 HTML5 中的 javascr ipt代码为例,如果需要向目标网页发送消息,标准消息发送器 120 可以利用下面的代码来进行:
windowOb jec t. pos tMes sage (data, ' *' ) ',
其中, windowOb jec t表示目标网页的窗口对象; data表示源网页待发送的 信息, 可以直接调用 pos tMes sage来发送消息。
定制消息发送器 130通过修改目标网页的特定属性值而将要发送的源网页 的消息发送给目标网页。 其中, 表示网域间消息传输的特定属性值可以为 w i ndow对象的 name属性值或者其它属性的属性值,也可以是两个以上的属性的 属性值。 - - 以 javascr ipt代码为例,如果需要向目标网页发送消息, 定制消息发送器 130可以利用下面的代码来进行:
windowOb ject. name = data;
其中 w i ndowOb j ec t表示目标网页的窗口对象; da t a表示源网页待发送的信 息, 定制消息发生器 130通过修改目标页面窗口对象的 name属性值为待发送消 息来实现消息发送。
上面图 1所示的浏览器中的消息发送设备 100既可以用于源网页和目标网 页位于相同的 URL域的情形,又可以用于源网页和目标网页位于不同的 URL域的 情形。 例如, 源网页和目标网页可以是位于同一个域 abc. example, com中的不 同网页, 也可以源网页是位于 abc. example, com的网页而目标网页是位于 def . example, com的网页。
另夕卜, 可选地, 图 1的浏览器中的消息发送设备 100可以只包括定制消息发 送器 130。 无论目标网页是否支持网域间消息传输机制, 例如 HTML5。 定制消息 发送器 130都通过修改目标网页的特定属性值(例如 window对象的 name属性值) 而将要发送的源网页的消息发送给目标网页。
图 2示出了根据本发明的一种实施方式的浏览器的消息发送方法 200的流 程图。 如图 2所示, 该消息发送方法 200始于步骤 S205 , 随后, 在步骤 S210 , 判 定浏览器是否支持网域间消息传输机制, 例如 HTML5 , 当判定浏览器支持网域 间消息传输机制时, 该方法进入步骤 S220 , 其中将要发送的源网页的消息通过 网域间的消息发送方式将要发送的源网页的消息发送给目标网页。 例如, 源网 页可以采取 pos tMes sage应用的方式向目标网页发送消息。 当在步骤 S210判定 当前浏览器不支持网域间消息传输机制时, 则该方法进入步骤 S230 , 其中通过 修改目标网页的特定属性值而将要发送的源网页的消息发送给目标网页。目标 网页的特定属性值可以为 window对象的 name属性值或者其它属性的属性值,也 可以是两个以上的属性的属性值。在步骤 S220或步骤 S230之后, 本发明的消息 发送方法以步骤 S 235结束。
在上面图 2所示的浏览器中的消息发送方法 200中,源网页和目标网页可以 位于相同的 URL域或者位于不同的 URL域。 例如, 二者可以位于同一个域 abc. example, com中的不同网页 ,也可以源网页是位于 abc. example, com的网页 而目标网页是位于 def. examp le, com的网页。
另外, 可选地, 图 2所示的浏览器中的消息发送方法可以只包括步骤: 通 过修改目标网页的特定属性值将要发送的源网页的消息发送给目标网页。在这 种实施方式中, 无论目标网页是否支持网域间消息传输机制,都通过修改目标 网页的特定属性值而将源网页的消息发送给目标网页。 - - 图 3示出了根据本发明的一种实施方式的浏览器中的消息接收设备 300的 框图。 消息接收设备 300使目标网页接收来自源网页的消息。 如图 3所示, 消息 接收设备 300包括第二判定器 310、标准消息接收器 320、和定制消息接收器 330。
第二判定器 31 0判定浏览器是否支持网域间消息传输机制。 当第二判定器 310判定浏览器支持网域间消息传输机制时,由标准消息接收器 320来接收来自 源页面的消息; 当第二判定器 310判定当前浏览器不支持网域间消息传输机制 时, 定制消息接收器 330接收来自源页面的消息。
标准消息接收器 320以网域间的消息接收方式来接收来自源网页的消息。 例如, 源网页与目标网页支持网域间消息传输, 则标准消息接收器 320可以采 取与 pos tMes sage相对应的方式接收来自源网页的消息。
以 j a V a c r i p t代码为例, 标准消息接收器 320以下列方式来接收消息: wan 360. xdomain. handler = function (e) {
wan 360. xdomain. cb (e. da ta) ;
};
if (window, a ddEven tLis t ener) {
window. addEven tLis tener ("message ", wan 360. xdoma in. handler , false)
} else if ( window, a t ta chEvcn t) {
window. a t tachEvcn t ("onmcssage ", wan 360. xdoma in. handler) ; }
其中, wan360. xdoma in. hand l er为要处理所接收的消息的函数。在标准消 息接收器 320中, 当接收到消息时, 会触发相应的事件 (根据不同的浏览器版 本 , 有 可 能是 mes sage 事 件 或 者 onmes sage 事 件 ) , 通 过将 wan360. xdoma in. hand l er注册为监控该事件, 当网页收到消息时,会触发相应 事件, 而监控事件的 wan360. xdoma in. hand l er就会接收到该消息并进行处理。
定制消息接收器 330定时检查目标网页的特定属性值是否发生变化, 如果 特定属性值发生变化, 则处理该特定属性值以获得来自源网页的消息。 其中, 网页的特定属性值可以为 window对象的 name属性值或者其它属性的属性值,也 可以是两个以上的属性的属性值。
以 javacr ipt代码为例, 定制消息接收器 330以下列方式来接收消息: var hash = / /
wan 360. xdomain. in terval Id = sc tln tcrval (function () {
if (window, name! =hash && window, name != {
hash = window, name; - - cb (hash) ;
}
人 100);
在上面的示例中, cb是处理消息的函数, 通过定期去检查 window对象的 name值是否发生改变或者是否为空,当 name值发生改变时,说明接收到了消息, 这时可以由 cb来处理该消息。
可选地, 图 3所示的消息接收设备 300还可以包括消息处理设备 (例如上面 示例中的 cb ) , 其处理由标准消息接收器 320和定制消息接收器 330所接收的来 自源网页的消息。 可选地, 该消息处理设备也可独立于消息接收设备 300而设 置。
可选地, 标准消息接收设备 320包括: 监听器 3210 , 其监听有否来自源网 页的消息; 和触发器 3220 , 当有来自源网页的消息时, 触发并接收该消息。
可选地, 定制消息接收器 330包括定时器 3310 , 其定时检查目标网页的特 定属性值是否发生变化且不为空。
上面图 3所示的浏览器中的消息接收设备 300既可以用于源网页和目标网 页位于相同的 URL域的情形,也可以用于源网页和目标网页位于不同的 URL域的 情形。 例如, 源网页和目标网页可以是位于同一个域 abc. examp l e, com中的不 同网页, 也可以源网页是位于 abc. examp l e, com的网页而目标网页是位于 def . examp l e, com的网页。
另夕卜, 可选地, 图 3所示的浏览器中的消息接收设备 300可以只包括定制消 息接收器 330。 无论目标网页是否支持网域间消息传输机制, 例如 HTML5 , 定制 消息接收器 330都定时检查目标网页的特定属性值是否发生变化, 如果特定属 性值发生变化, 则处理该特定属性值以获得来自源网页的消息。
图 4示出了根据本发明的一种实施方式的浏览器的消息接收方法 400的流 程图, 用于使目标网页接收来自源网页的消息。 如图 4所示, 该消息接收方法 400始于步骤 S405 , 随后, 在步骤 S410 , 判定浏览器是否支持网域间消息传输 机制, 例如是否支持 HTML5。 当判定浏览器支持网域间消息传输机制时, 则执 行步骤 S420 , 以网域间的消息接收方式来接收来自源网页的消息。 例如, 目标 网页可以采取与 po s t Me s s a ge应用相对应的方式接收来自源网页的消息。 在步 骤 S41 0中, 判定当前浏览器不支持网域间消息传输机制时, 则该方法进入步骤 S430 , 其中定时检查目标网页的特定属性值是否发生变化,如果特定属性值发 生变化, 则处理该特定属性值以获得来自源网页的消息。 其中, 网页的特定属 性值可以为 wi ndow对象的 name属性值或者其它属性的属性值,也可以是两个以 上的属性的属性值。 在步骤 S420或步骤 S430之后可以直接以步骤 S445结束, 可选地, 在步骤 S420或步骤 S430之后, 消息接收方法 400还可以包括步骤 S440 , 其中, 处理接 收到的来自源网页的消息, 以供在目标网页显示。 然后, 再以步骤 S445结束。
上面图 4所示的浏览器中的消息接收方法既可以用于源网页和目标网页位 于相同的 URL域的情形, 也可以用于源网页和目标网页位于不同的 URL域的情 形。 例如, 源网页和目标网页可以是位于同一个域 abc. examp l e, com中的不同 网页, 也可以源网页是位于 abc. examp l e. com的网页而 3标网页是位于 def. examp l e, com的网页。
图 5示出了根据本发明的一种实施方式的浏览器的通信系统 500的框图,其 用于源网页与目标网页之间的通信。 如图 5所示, 本发明的浏览器的通信系统 500包括图 1中所示的消息发送设备 1 00和图 3中所示的消息接收设备 300。其中, 消息发送设备 100包括图 1中所示的第一判定器 1 10、标准消息发送器 120、和定 制消息发送器 1 30。 消息接收设备 300包括图 3中所示的第二判定器 310、标准消 息接收器 320、 和定制消息接收器 330。
具体地,消息发送设备 100中的第一判定器 110判定浏览器是否支持网域间 消息传输机制, 例如 HTML5。 当判定浏览器支持网域间消息传输机制时, 将要 发送的源网页的消息传送至标准消息发送器 120。标准消息发送器 120将源网页 的消息以网域间的消息发送方式发送给消息接收设备 300的第二判定器 310。第 二判定器 31 0判定浏览器是否支持网域间消息传输机制, 当判定浏览器支持网 域间消息传输机制时, 由标准消息接收器 320接收来自源页面的消息。
当第一判定器 110判定浏览器不支持网域间消息传输机制时, 将要发送的 源网页的消息传送至定制消息发送器 1 30。定制消息发送器 1 30通过修改目标网 页的特定属性值而将要发送的源网页的消息发送给消息接收设备 300的第二判 定器 310 , 第二判定器 310判定浏览器是否支持网域间消息传输机制, 当判定浏 览器不支持网域间消息传输机制时, 由定制消息接收器 330定时检查目标网页 的特定属性值是否发生变化,如果特定属性值发生变化, 则处理该特定属性值 以获得来自源网页的消息。
可选地, 本发明的浏览器的通信系统还可以包括消息处理器 510。 消息处 理器 510处理标准消息接收器 320或者定制消息接收器 330所接收的消息。
本发明的浏览器的通信系统 500既可以用于源网页和目标网页位于相同的
URL域的情形, 又可以用于源网页和目标网页位于不同的 URL域的情形。 例如, 源网页和目标网页可以是位于同一个域 abc. examp l e, com中的不同网页, 也可 以源网页是位于 abc. examp l e, com的网页而目标网页是位于 def. examp l e, com 的网页。 - - 另夕卜, 可选地,本发明的浏览器的通信系统 500中的消息发送设备 100可以 只包括定制消息发送器 130 ,相应地, 消息接收设备 300可以只包括定制消息发 送器 330。 在这种情形下, 无论目标网页是否支持网域间消息传输, 定制消息 发送器 130都通过修改目标网页的特定属性值(例如 window对象的 name属性值) 而将要发送的源网页的消息发送给目标网页, 相应地, 定制消息接收器 330都 定时检查目标网页的特定属性值是否发生变化,如果特定属性值发生变化, 则 处理该特定属性值以获得来自源网页的消息。
另外, 本发明的浏览器的通信系统 500可以如上所述, 其中的消息发送设 备 100设置于源网页中, 而消息接收设备 300设置于目标网页中,从而使得目标 网页总是可以接受来自源网页的消息。 但本发明的浏览器的通信系统 500并不 限于此, 在源网页和目标网页中都可以既包含消息发送设备 100 , 也包含消息 接收设备 300 , 以便任何一个网页都既可以发送消息也可以接收消息。
下面通过一个具体的例子对本发明的浏览器的通信系统 500进行更为详细 的说明。
在该例子中,本发明的浏览器的通信系统 500使位于第一域 a. com中的一个 网页 parent, html与其通过 if rame嵌入的第二域 b. com中的网页 chi ld, html之 间进行跨域通信。 其中, 第一域中的网页 parent, html为源网页, 第二域中的 网页 chi ld, html称为目标网页。
第一域中的网页 parent, html具有消息发送设备 100 , 其通过 sendMes sage 负责向目标网页发送消息。 第二域中的网页 chi ld. html具有消息接收设备 300 和消息处理器 510 ,消息接收设备 300通过监听而负责接收源网页发送过来的消 息并将消息交由消息处理器 510进行处理。
消息发送设备 100具有第一判定器 110、 标准消息发送器 120和定制消息发 送器 130。其中第一判定器 110判断浏览器是否支持 HTML5 ,例如 Fi refox, IE8+, Opera, Safar i, Chrome为支持 HTML5的浏览器, 而 IE6和 IE7为不支持 HTML5的 浏览器。 当判定浏览器支持 HTML5时, 标准消息发送器 120通过 HTML5的 pos tMes sage函数将消息发送到目标网页, 否则, 定制消息发送器 130通过修改 目标网页中的 window对象的 name属性向目标网页发送消息。
消息接收设备 300包括第二判定器 310、 标准消息接收器 320和定制消息接 收器 330。 其中, 第二判定器 310判断浏览器是否支持 HTML5 , 如果判定浏览器 支持 HTML5 , 贝' J标准消息接收器 320通过 addEventL i s tener或 a t tachEvent (视 浏览器支持情况选择)添加消息监听事件, 例如源网页来消息即为一事件, 通 过事件触发而获取源网页传递的消息,再将消息交给消息处理器 510进行处理; 否则, 定制消息接收器 330将定时探测目标网页的 window对象的 name属性值, - - 当 name属性值发生变化且不为空时, 获取源页面发送的消息, 然后交给消息处 理器 510进行处理。 另外, 本发明还提供一种根据本发明的一种实施方式的浏 览器的通信方法 600的流程图,如图 6所示, 其用于源网页与目标网页之间的通 信。该浏览器的通信方法如于步骤 S605 , 然后执行图 2中所示的消息发送方法、 之后执行图 4中所示的消息接收方法, 然后以步骤 S665结束该通信方法。 关于 前述消息发送方法具体参见前面关于图 2的描述, 关于前述消息接收方法具体 参见前面关于图 4的描述, 这里不再重复描述。
总结而言, 为了实现采用 HTML5的浏览器的 Web页面(以下称为 "源网页" ) 与其通过 i f rame嵌入的不同域的 Web页面 (以下称为 "目标网页" )之间的跨 域通信, 本发明首先判断目标网页是否支持 HTML5 , 如果支持 HTML5 , 则采用 HTML5的消息发送方式即 pos tMes sage应用进行通信, 如果不支持 HTML5 , 则通 过修改目标网页 window对象的 name属性完成消息的发送,而目标网页则通过判 断 window对象的 name属性的值是否发生变化或者是否为空来判断是否接收消 息, 由此可以实现不同域的 Web页面之间的跨域通信。
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有 相关。 各种通用系统也可以与基于在此的示教一起使用。 根据上面的描述, 构 造这类系统所要求的结构是显而易见的。此外, 本发明也不针对任何特定编程 语言。 应当明白, 可以利用各种编程语言实现在此描述的本发明的内容, 并且 上面对特定语言所做的描述是为了披露本发明的最佳实施方式。
在此处所提供的说明书中, 说明了大量具体细节。 然而, 能够理解, 本发 明的实施例可以在没有这些具体细节的情况下实践。在一些实例中, 并未详细 示出公知的方法、 结构和技术, 以便不模糊对本说明书的理解。
类似地,应当理解, 为了精筒本公开并帮助理解各个发明方面中的一个或 多个,在上面对本发明的示例性实施例的描述中, 本发明的各个特征有时被一 起分组到单个实施例、 图、 或者对其的描述中。 然而, 并不应将该公开的方法 解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确 记载的特征更多的特征。 更确切地说, 如下面的权利要求书所反映的那样, 发 明方面在于少于前面公开的单个实施例的所有特征。 因此, 遵循具体实施方式 的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为 本发明的单独实施例。
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适 应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实 施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它 们分成多个子模块或子单元或子组件。 除了这样的特征和 /或过程或者单元中 - - 的至少一些是相互排斥之外, 可以采用任何组合对本说明书(包括伴随的权利 要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所 有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、 摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征 来代替。
此外, 本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它 实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意 味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求 书中, 所要求保护的实施例的任意之一都可以以任意的组合方式来使用。
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器 上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解, 可以在实践中使用微处理器或者数字信号处理器(DSP )来实现根据本发明实 施例中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执 行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程 序和计算机程序产品 )。这样的实现本发明的程序可以存储在计算机可读介质 上, 或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上 下载得到, 或者在载体信号上提供, 或者以任何其他形式提供。
例如, 图 7示出了可以实现根据本发明的用户请求处理方法的智能电子 设备。 该智能电子设备传统上包括处理器 710和以存储器 720形式的计算机 程序产品或者计算机可读介质。 存储器 720可以是诸如闪存、 EEPROM (电 可擦除可编程只读存储器) 、 EPROM、 硬盘或者 ROM之类的电子存储器。 空间 730。 例如, 用于程序代码的存储空间 730可以包括分别用于实现上面 的方法中的各种步骤的各个程序代码 731。这些程序代码可以从一个或者多 个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。 这些计算机程序产品包括诸如硬盘, 紧致盘(CD ) 、 存储卡或者软盘之类 的程序代码载体。这样的计算机程序产品通常为如参考图 8所述的便携式或 者固定存储单元。 该存储单元可以具有与图 7的智能电子设备中的存储器 720类似布置的存储段或者存储空间等。程序代码可以例如以适当形式进行 即可以由例如诸如 710之类的处理器^卖取的代码,这些代码当由智能电子设 备运行时, 导致该智能电子设备执行上面所描述的方法中的各个步骤。
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并 且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施 - - 例。在权利要求中, 不应将位于括号之间的任何参考符号构造成对权利要求的 限制。 单词 "包含" 不排除存在未列在权利要求中的元件或步骤。 位于元件之 前的单词 "一" 或 "一个" 不排除存在多个这样的元件。 本发明可以借助于包 括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干 装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体 体现。 单词第一、 第二、 以及第三等的使用不表示任何顺序。 可将这些单词解 释为名称。

Claims

权 利 要 求
1、 一种消息发送设备, 适于在浏览器中将来自源网页的消息向目标网页 发送, 该消息发送设备包括:
定制消息发送器,其通过修改目标网页的特定属性值而将要发送的源网页 的消息发送给目标网页。
2、 如权利要求 1所述的消息发送设备, 其还包括:
标准消息发送器,其通过网域间消息发送方式将要发送的源网页的消息发 送给目标网页; 以及
第一判定器, 其判定所述浏览器是否支持网域间消息传输机制, 当判定所 述浏览器支持网域间消息传输机制时,将要发送的源网页的消息传送至所述标 准消息发送器, 当第一判定器判定所述浏览器不支持网域间消息传输机制时, 将要发送的源网页的消息传送至所述定制消息发送器。
3、 如权利要求 1或 2所述的消息发送设备, 其中, 源网页和目标网页属于 不同的 URL域。
4、 如权利要求 1-3中任何一项所述的消息发送设备, 其中, 所述特定属性 值为 w i ndow对象的 name属性值。
5、 一种消息发送方法, 用于在浏览器中将来自源网页的消息向目标网页 发送, 包括步骤:
通过修改目标网页的特定属性值而将要发送的源网页的消息发送给目标 网页。
6、 根据权利要求 5所述的消息发送方法, 还包括步骤:
判定浏览器是否支持网域间消息传输机制,
当判定所述浏览器支持网域间消息传输机制时,将要发送的源网页的消息 通过网域间消息发送方式将要发送的源网页的消息发送给目标网页, 以及
当判定所述浏览器不支持网域间消息传输机制时,利用所述通过修改目标 网页的特定属性值而将要发送的源网页的消息发送给目标网页来发送消息。
7、 根据权利要求 5或 6所述的消息发送方法, 其中, 源网页和目标网页属 于不同的 URL域。
8、根据权利要求 5-7中任何一项所述的消息发送方法, 其中, 所述目标网 页的特定属性值为 w i n d 0 w对象的 n a m e属性值。
9、 一种消息接收设备, 适于在浏览器中从目标网页接收来自源网页的消 息, 该消息接收设备包括:
定制消息接收器,其定时检查目标网页的特定属性值是否发生变化,如果 所述特定属性值发生变化, 则处理该特定属性值以获得来自源网页的消息。
10、 根据权利要求 9所述的消息接收设备, 还包括:
标准消息接收器,其以网域间消息接收方式来接收来自源网页的消息; 和 第二判定器, 其判定所述浏览器是否支持网域间消息传输机制, 当判定所 述浏览器支持网域间消息传输机制时,由所述标准消息接收器来接收来自源页 面的消息, 当第二判定器判定所述浏览器不支持网域间消息传输机制时, 由所 述定制消息接收器接收来自源页面的消息。
11、 如权利要求 9或 10所述的消息接收设备, 其中所述源网页和所述目标 网页属于不同的 URL域。
12、 根据权利要求 9-1 1中任一个所述的消息接收设备, 其中,
所述标准消息接收器包括:
监听器, 其监听有否来自源网页的消息; 和
触发器, 当有来自源网页的消息时, 触发并接收该消息,
所述定制消息接收器包括:
定时器, 其定时检查目标网页的特定属性值是否发生变化且不为空。
1 3、 根据权利要求 9-12中任何一项所述的消息接收设备, 还包括: 消息处理器,其处理所述标准消息接收器或者所述定制消息接收器所接收 的消息。
14、 如权利要求 9-1 3中任何一项所述的消息接收设备, 其中
所述目标网页的特定属性值为 window对象的 name属性值。
15、一种消息接收方法, 用于使浏览器中的目标网页接收来自源网页的消 息, 所述消息接收方法包括步骤:
定时检查目标网页的特定属性值是否发生变化,如果所述特定属性值发生 变化, 则处理该特定属性值以获得来自源网页的消息。
16、 根据权利要求 15所述的消息接收方法, 还包括如下步骤:
判定浏览器是否支持网域间消息传输机制,
当判定所述浏览器支持网域间消息传输机制时,以网域间消息接收方式来 接收来自源网页的消息, 以及
当判定所述浏览器不支持网域间消息传输机制时,定时检查目标网页的特 定属性值是否发生变化,如果所述特定属性值发生变化, 则处理该特定属性值 以获得来自源网页的消息。
17、根据权利要求 15或 16所述的消息接收方法, 其中所述源网页和所述目 标网页属于不同的 URL域。
18、 根据权利要求 15-17所述的消息接收方法, 其中
所述目标网页的特定属性值为 window对象的 name属性值。
19、 一种浏览器的通信系统, 其用于源网页与目标网页之间的通信, 所述 源网页和目标网页分别包括:
根据权利要求 1、 3、 和 4中任何一项所述消息发送设备; 以及
根据权利要求 9和 11-14中任何一项所述消息接收设备。
20、 一种浏览器的通信系统, 其用于源网页与目标网页之间的通信, 所述 源网页和目标网页分别包括:
根据权利要求 2、 3、 和 4中任何一项所述消息发送设备; 以及
根据权利要求 10和 11 -14中任何一项所述消息接收设备。
21、 一种浏览器的通信方法 , 其用于源网页与目标网页之间的通信, 该 通信方法包括:
根据权利要求 5所述的消息发送方法; 以及
根据权利要求 15所述的消息接收方法。
22、 一种浏览器的通信方法 , 其用于源网页与目标网页之间的通信, 该 通信方法包括:
根据权利要求 6-8中任何一项所述的消息发送方法; 以及
根据权利要求 16-18中任何一项所述的消息接收方法。
23、一种通信系统, 其用于源网页与目标网页之间的通信, 所述源网页和 目标网页分别包括:
消息发送设备,适于在浏览器中将来自源网页的消息向目标网页发送; 以 及
消息接收设备, 适于在浏览器中从目标网页接收来自源网页的消息。
24、 一种通信方法 , 其用于源网页与目标网页之间的通信, 该通信方法 包括:
消息发送步骤,用于在浏览器中将来自源网页的消息向目标网页发送; 以 及
消息接收步骤, 用于使浏览器中的目标网页接收来自源网页的消息。
25、 一种计算机程序, 包括计算机可读代码, 当智能电子设备运行所述计 算机可读代码运行时, 导致权利要求 5-8、 15-18、 21和 22中的任一项权利要求 所述的方法被执行。
26、 一种计算机可读介质, 其中存储了如权利要求 25所述的计算机程序。
PCT/CN2013/085316 2012-10-19 2013-10-16 浏览器中的消息发送设备和接收设备及方法和系统 Ceased WO2014059930A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210401336.XA CN102882982B (zh) 2012-10-19 2012-10-19 浏览器中的消息发送设备和接收设备及方法和系统
CN201210401336.X 2012-10-19

Publications (1)

Publication Number Publication Date
WO2014059930A1 true WO2014059930A1 (zh) 2014-04-24

Family

ID=47484124

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/085316 Ceased WO2014059930A1 (zh) 2012-10-19 2013-10-16 浏览器中的消息发送设备和接收设备及方法和系统

Country Status (2)

Country Link
CN (2) CN102882982B (zh)
WO (1) WO2014059930A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114116263A (zh) * 2021-12-01 2022-03-01 工银科技有限公司 用于浏览器中多页签通信的系统、方法、设备及介质

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102882982B (zh) * 2012-10-19 2015-10-07 北京奇虎科技有限公司 浏览器中的消息发送设备和接收设备及方法和系统
CN105373548B (zh) * 2014-08-25 2020-10-13 腾讯科技(深圳)有限公司 移动设备及其浏览器自定义事件的方法
CN104317819A (zh) * 2014-09-28 2015-01-28 北京京东尚科信息技术有限公司 基于浏览器页面间跨域通信的方法和系统
CN113329028B (zh) * 2021-06-17 2022-08-30 中国农业银行股份有限公司 跨域访问方法及设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101106572A (zh) * 2007-08-23 2008-01-16 中兴通讯股份有限公司 传送资源控制功能单元之间实现跨域通信的方法
CN102662600A (zh) * 2012-04-28 2012-09-12 北京亿中邮信息技术有限公司 一种不同域名下文件相互拖拽的方法
CN102882982A (zh) * 2012-10-19 2013-01-16 北京奇虎科技有限公司 浏览器中的消息发送设备和接收设备及方法和系统
CN102917058A (zh) * 2012-10-19 2013-02-06 北京奇虎科技有限公司 一种通信方法和系统

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102043832A (zh) * 2010-11-23 2011-05-04 苏州阔地网络科技有限公司 一种网页上实现跨域请求回调的方法
CN102393857B (zh) * 2011-11-01 2014-04-09 中兴通讯股份有限公司 一种用网页进行本地调用的方法和系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101106572A (zh) * 2007-08-23 2008-01-16 中兴通讯股份有限公司 传送资源控制功能单元之间实现跨域通信的方法
CN102662600A (zh) * 2012-04-28 2012-09-12 北京亿中邮信息技术有限公司 一种不同域名下文件相互拖拽的方法
CN102882982A (zh) * 2012-10-19 2013-01-16 北京奇虎科技有限公司 浏览器中的消息发送设备和接收设备及方法和系统
CN102917058A (zh) * 2012-10-19 2013-02-06 北京奇虎科技有限公司 一种通信方法和系统

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114116263A (zh) * 2021-12-01 2022-03-01 工银科技有限公司 用于浏览器中多页签通信的系统、方法、设备及介质

Also Published As

Publication number Publication date
CN102882982B (zh) 2015-10-07
CN105306341B (zh) 2019-05-28
CN102882982A (zh) 2013-01-16
CN105306341A (zh) 2016-02-03

Similar Documents

Publication Publication Date Title
CN102801574B (zh) 一种网页链接的检测方法、装置和系统
TWI654860B (zh) Hybrid application client resource calling method, client and system
US9794242B2 (en) Method, apparatus and application platform for realizing logon to an application service website
CN113840012B (zh) 基于区块链的录屏取证方法、系统和电子设备
CN104125258B (zh) 页面跳转方法、终端、服务器和系统
WO2016034063A1 (zh) 基于伪基站的恶意短信息处理方法及客户端
US20160269433A1 (en) Method and system for checking security of url for mobile terminal
CN103501331B (zh) 数据传输方法、设备及系统
US20140325089A1 (en) Method, terminal, server and system for page jump
WO2013056564A1 (zh) 浏览器内核适配的方法和浏览器
CN106899549B (zh) 一种网络安全检测方法及装置
CN102592089A (zh) 网页重定向跳转漏洞检测方法及装置
WO2017097262A1 (zh) 数据交互方法和装置及计算机程序和计算机可读介质
US10979532B2 (en) Resource download method, electronic device, and apparatus
WO2016101753A1 (zh) 请求信息统一处理的方法和装置
CN105657000A (zh) 消息传送方法及装置
JP5952304B2 (ja) インスタントメッセージング情報を伝送してフィルタにかけるためのシステムおよび方法
CN104394475A (zh) 一种流媒体文件的播放方法及媒体播放器
CN102882982B (zh) 浏览器中的消息发送设备和接收设备及方法和系统
CN105141709A (zh) 确定应用程序内页面跳转的方法及装置
WO2016000176A1 (zh) 一种页面插入方法和设备
CN102984218A (zh) 浏览器及其登录方法及系统
CN102917058B (zh) 一种通信方法和系统
US20130198364A1 (en) Method of determining http process information
CN103501334A (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: 13846774

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: 13846774

Country of ref document: EP

Kind code of ref document: A1