Today, many browsers are designed to disallow what is known as cross site scripting. That is, web pages are associated with domains. If a web page from a one domain attempts to communicate or execute a script on a web page from a different domain, many web browsers will disallow the communication or script execution. There are various reasons why this is done, many of which pertain to security.
Notwithstanding the concerns associated with security and which have driven, to a certain extent, the restrictions on cross site scripting, there is value that can arise by allowing communication across different domains.
Various embodiments utilize nested Iframes within a web page to allow cross domain communication. That is, various embodiments can create an is embedded Iframe that shares the domain of an Iframe or web page with which communication is desired. Because the embedded Iframe shares the domain of the Iframe or web page with which communication is desired, restrictions on cross-site scripting do not inhibit communication or scripting between the domain-matched Iframe(s) and/or web page. This embedded Iframe can then provide a mechanism by which web pages or Iframes from other domains can communicate with the Iframe or web page with which the embedded Iframe shares a domain.
The inventive approach can be utilized in the context of sending insecure and secure messages. Further, in at least some embodiments, reliability can be enhanced by providing a reliability mechanism that can be used to track and confirm messages that are sent back and forth between the domain-matched Iframe and web page.
Overview
Various embodiments utilize nested Iframes within a web page to allow cross domain communication. That is, various embodiments can create an embedded Iframe that shares the domain of an Iframe or web page with which communication is desired. Because the embedded Iframe shares the domain of the Iframe or web page with which communication is desired, restrictions on cross-site scripting do not inhibit communication or scripting between the domain-matched Iframe(s) and/or web page. This embedded Iframe can then provide a mechanism by which web pages or Iframes from other domains can communicate with the Iframe or web page with which the embedded Iframe shares a domain.
The inventive approach can be utilized in the context of sending insecure and secure messages. Further, in at least some embodiments, reliability can be enhanced by providing a reliability mechanism that can be used to track and confirm messages that are sent back and forth between the domain-matched Iframe and web page.
Iframes and the manner in which Iframes work will be appreciated by the skilled artisan and, as such, are not described in great detail here. However, for some basic context on Iframes, consider the following.
An Iframe is a construct which embeds a document, such as a web page, into an HTML document. Traditionally, Iframes have been used so that embedded data can be displayed inside a subwindow of the browser's window. This does not mean full inclusion; the two documents are independent, and both them are treated as complete documents, instead of treating one as part of the other.
Basically, an iframe element is of the form;
Browsers which support Iframes display or load the document referred to by the URL in a subwindow, typically with vertical and/or horizontal scroll bars; such browsers ignore the content of the iframe element (i.e. everything between the start tag <iframe . . . > and the end tag </iframe>).
In the discussion that follows, Iframe are re-purposed, in a sense, to enable cross domain communication.
In the discussion below, the following primary sections are provided. First, a section entitled “Exemplary Environment” is provided and describes but one example of an environment in which the inventive embodiments can be employed. Following this, a section entitled “Establishing A Cross Domain Message Delivery System” is provided and describes how a cross domain message delivery system can be created in accordance with one embodiment. Next, a section entitled “Using the Cross Domain Message Delivery System” is provided and describes how one can use the cross domain message delivery system in accordance with one embodiment. Following this, a section entitled “Reliable Messaging” is provided and describes one embodiment in which a degree of reliability can be added to the cross domain communication of messages. Finally, a section entitled “Using Cross Domain Communication to Facilitate Social Networking” is provided and describes but one example of how cross domain communication can be utilized.
Exemplary Environment
Here, system 100 includes a client computing device 102 which includes one or more processors 104 and one or more computer-readable media 106 on which executable, computer-readable instructions reside. In this example, computer-readable media 106 includes instructions in the form of code that implements one or more applications such as web browser 108. The various embodiments described below can be implemented in connection with any suitable type of application.
Web browser 108 is configured to communicate with one or more servers 110 via a network such as the Internet 112. In practice, browser 108 can receive web content from server 110 and render such content for a user in the form of a web page, an example of which is shown at 114. In the examples below, browser 108 can be used to render Iframes within a web page to create a cross domain message delivery system that can permit cross domain communication, as will become apparent.
It is to be appreciated and understood that while computing device 102 is illustrated as a desk top computing device, other computing devices such as laptop devices, notebook devices, handheld devices and the like can be utilized without departing from the spirit and scope of the claimed embodiments.
Establishing a Cross Domain Message Delivery System
Web page 114 is said to be a “containing page” because it contains the two created Iframes. In this example, web page 114 has been created in a first domain—domain A. Notice here that Iframe 116 has been created in domain A and Iframe 118 has been created in domain B. Each of Iframes 116 and 118 includes or contains, in this example, a listener Iframe that shares its Iframe's domain. Hence, Iframe 116 contains listener Iframe 116a and Iframe 118 contains listener Iframe 118a. Iframes 116 and 118 can be considered as “containing frames” because they contain other Iframes. The listener Iframes 116a, 118a can be considered as embedded or nested Iframes that serve as target windows for cross domain communication that takes place, as will become apparent below.
In accordance with one embodiment, the cross domain message delivery system can be created as follows.
When the containing page—here page 114—loads, it creates Iframe 116 in its own domain and passes into the Iframe a name that is to be used for a corresponding listener Iframe. Although any suitable name can be used, in this example the name comprises a private hash which, in the illustrated example, is represented as “abc”. Iframe 116 then creates the listener or nested Iframe 116a in its domain using the private hash as its name. Nested Iframe 116a is associated with an URL that is used for cross domain communication and is the message receiver or target window for messages intended for containing page 114.
In addition, containing page 114 can also create Iframe 118 in a different domain—domain B—and pass in a name that is to be used for a corresponding listener Iframe. Although any suitable name can be used, in this example the name comprises a private hash which, in the illustrated example, is represented as “def”. Iframe 118 then creates the listener or nested Iframe 118a in its domain using the private hash as its name. Nested Iframe 118a is associated with an URL that is used for cross domain communication and serves as the message receiver or target window for messages intended for the containing Iframe 118.
In this example, if communication is to take place between Iframes 116 and 118, each is provided with the name of the listener Iframe for the other. So, for example, Iframe 116 is provided with the name “def” and Iframe 118 is provided with the name “abc”. This can typically take place when the Iframe is initially created in the containing page 114.
Step 300 loads a containing web page and step 302 creates an Iframe that is contained within the web page. Step 302 can be performed multiple different times to create multiple different Iframes in the same and/or different domains from that of the containing web page. Step 304 passes a name to the Iframe. This step can be performed multiple different times as well and can be performed as part of the process of creating the Iframe. The name is to be used in connection with a nested listener Iframe that is to be created. Step 306 creates a nested Iframe using the name that was passed to the Iframe. This step can be performed multiple different times and can be performed by a corresponding Iframe that was created.
At this point, a cross domain message system, such as that illustrated in
Using the Cross Domain Message Delivery System
In accordance with one embodiment, when a web page from a different domain wishes to communicate with a particular Iframe, it manipulates an URL associated with the Iframe's listener Iframe and includes, in the URL, the message that is desired to be communicated to the Iframe. In this particular example, cross domain communication can take place in connection with a server. This can permit a degree of security that is provided by the server. That is, the server can process the cross domain messages in many different ways such as by validating the messages, verifying the sender and the like.
For example, in the example of
window.open(http://Domain_B/secure_msg.aspx?[message] def)
This call opens a window in the B domain, and it calls a secure message page “secure_msg.aspx” to implement some type of security procedure. After this portion of the URL, the message that is intended to be sent, i.e. “[message]” is appended, as is the name of the window to which the message is targeted—here, “def”.
Assuming that any security issues pertaining to the message are resolved favorably, the server then causes the message to load in the nested Iframe 118a which is in Iframe 118's domain. Nested Iframe 118a can then notify its parent or containing Iframe that it has a message. Iframe 118 can then process the message accordingly, as by executing scripts using the message.
To respond, Iframe 118 would simply issue a call to open a window or load a page in the listener Iframe 116a for Iframe 116. This call, routed through the server, would then cause a window to be opened or a page which contains the message to be loaded in listener Iframe 116a.
This process is diagrammatically shown in
Hence, using this approach can allow messages and other information to be communicated across different domains.
Step 500 creates a message that is intended to be communicated to a different domain. Any suitable type of message can be created. For example, one message might be a refresh message that causes another document to refresh (e.g., a stock list component can be notified to refresh stock quotes. Other messages can present ambient properties pertaining to the mode of a page such as “author” versus “view” mode, or share stylistic information (e.g., a stock quote component can switch to allow new stocks to be added, or a particular theme can be shared with the component. Further, some messages can request metadata (e.g. a list of contacts, books and the like can be requested and returned to the other page).
Step 502 includes the message in an URL associated with a listener Iframe in the different domain. One example of how this can be done is provided above. Step 504 initiates a call to a server that includes the URL. One example of how this can be done is provided above.
Step 506 receives the call from the client at the server and step 508 processes the message. Any suitable processing can take place. In the example above, the processing that takes place pertains to security. Other types of processing can take place. Step 510 returns to the client to cause the message to be processed by the listener Iframe.
Step 512 processes the message with the listener Iframe and step 514 notifies the containing Iframe that a message has been received. This step is performed by the listener Iframe.
In the embodiment described just above, a server is utilized to facilitate cross domain message delivery. Incorporating a server into the process can enable the message processing to be augmented in some way, such as by providing server-enhanced security processes. It is possible, however, for cross domain message delivery to take place in a purely client side manner without round tripping to the server.
In this embodiment, cross domain messages are sent by manipulating the URL of the Iframe that is contained with a web page. As an example, consider the following. Each individual Iframe in a web page is associated with an URL. An URL typically has the following form:
The authority typically consists of the name or IP address of a server, optionally followed by a colon and a TCP port number. It may also contain a username and password for authenticating to the server. The path is a specification of a location in some hierarchical structure, using a slash (“/”) as delimiter between components. The query typically expresses parameters of a dynamic query to some database, program, or script residing on the server. The fragment occurs after the hash “#” and identifies a portion of a resource, often a location in a document. Fragments or hashes are interpreted on the client side and are not typically used by the server.
In accordance with this embodiment, when a containing page from a different domain wishes to communicate or send a message to an Iframe in another domain, it appends the message to the appropriate Iframe's URL after the hash. Thus, a message to an Iframe from another domain would take the following form:
when the Iframe detects the URL change, it can parse the URL to access the message and can then process the message accordingly. If the Iframe wishes to communicate back to the containing page or another listener, it uses a similar approach—that is, it manipulates the URL of the intended recipient to append the message after the hash in the recipient's URL. If the intended recipient is a listener Iframe for the containing page, then the listener Iframe can receive the message and because it shares the domain of the containing page, it can call functions in the containing page—such as a notification function to notify the containing page that it has received a new message.
In this embodiment, all of the message sending and receiving can take place without round tripping to the server. Thus, server resources can be conserved.
Reliable Messaging
In at least some embodiments, message reliability can be enhanced by adding a unique message counter associated with each message that is sent from a particular domain. For example, in some instances, a particular Iframe may be the subject of a number of incoming messages. Yet, if these messages arrive at the same time, there is a chance that at least some of the messages will be missed. In this case, each message from a particular domain is associated with a unique, incremental ID that is incremented for each new message from that domain. When the Iframe receives a particular message from a particular domain, if the message counter is off by one or more increments, then the Iframe knows to request the missing messages from the sender. The message counter can be implemented as a field in the URL associated with the targeted recipient of the message.
Alternately or additionally, reliable messaging can be enhanced by having individual Iframes communicate back acknowledgements to the message originator that a particular message has been received. The message originator can also, if so desired, query the recipient to ascertain whether the recipient received the message.
Other Extensions
Using the above-described approach, a containing web page can also act as an intermediary between Iframes from different domains or allow the frames to communicate directly by giving each the name of the target window in the other. One of the things that this can enable is remote procedure calls or RPC. That is, a message schema can be utilized that allows messages to be defined for invoking methods or operations in other domains. In this way, a distributed RPC-like mechanism is provided for executing actions in other domains.
Using Cross Domain Communication to Facilitate Social Networking
There are instances when it would be desirable to enable a third party web site to utilize aspects of a user's relationships with others to provide the user a rich experience. For example, a user may have a large “buddy list” as part of their instant messaging application. Some third party web site might have applications that could provide the user with a rich and robust experience if it only had access to the buddy list. For example, a third party web site might be able to show you all of your buddies' wish lists. Yet, for purposes of privacy, it is not desirable to provide the third party web site with access to the user's buddy list.
In the embodiment described below, nested Iframes are utilized to provide a rich and robust experience in which relationship information can be shared, yet protected.
As an example, consider
That is, in this instance, we would like to have the ability to send information associated with Iframe 602 to web page 600. In accordance with one embodiment, when web page 600 loads, it creates Iframe 602 and provides it with a postback URL that can be used to communicate with web page 600. When Iframe 602 creates nested Iframe 606 (in the same domain as web page 600), it provides the nested Iframe with information on the postback URL. Since Iframe 606 and web page 600 are in the same domain, there are no cross site scripting restrictions that would prevent them from communicating. The web page 600 and Iframe 606 can now communicate using, for example, jscript.
Consider now
In this way, third party web sites can access and leverage relationship information associated with a particular user, while at the same time such relationship information is protected.
Various embodiments utilize nested Iframes within a web page to allow cross domain communication. That is, various embodiments can create an embedded Iframe that shares the domain of an Iframe or web page with which communication is desired. Because the embedded Iframe shares the domain of the Iframe or web page with which communication is desired, restrictions on cross-site scripting do not inhibit communication or scripting between the domain-matched Iframe(s) and/or web page. This embedded Iframe can then provide a mechanism by which web pages or Iframes from other domains can communicate with the Iframe or web page with which the embedded Iframe shares a domain.
Although the invention has been described in language specific to structural features and/or methodological steps, it is to be understood that the invention defined in the appended claims is not necessarily limited to the specific features or steps described. Rather, the specific features and steps are disclosed as preferred forms of implementing the claimed invention.
Number | Name | Date | Kind |
---|---|---|---|
4227253 | Ehrsam et al. | Oct 1980 | A |
5210874 | Karger | May 1993 | A |
5339422 | Brender et al. | Aug 1994 | A |
5377188 | Seki | Dec 1994 | A |
5666519 | Hayden | Sep 1997 | A |
6275938 | Bond et al. | Aug 2001 | B1 |
6801224 | Lewallen | Oct 2004 | B1 |
6934757 | Kalantar et al. | Aug 2005 | B1 |
7318238 | Elvanoglu et al. | Jan 2008 | B2 |
7328435 | Trifon | Feb 2008 | B2 |
20030002526 | Dias et al. | Jan 2003 | A1 |
20030023880 | Edwards et al. | Jan 2003 | A1 |
20030093666 | Millen et al. | May 2003 | A1 |
20030135504 | Elvanoglu et al. | Jul 2003 | A1 |
20030177226 | Garg et al. | Sep 2003 | A1 |
20040210536 | Gudelj et al. | Oct 2004 | A1 |
20040215731 | Tzann-en Szeto | Oct 2004 | A1 |
20040254812 | Horstemeyer | Dec 2004 | A1 |
20040268139 | Christian et al. | Dec 2004 | A1 |
20050055458 | Mohan et al. | Mar 2005 | A1 |
20050204041 | Blinn et al. | Sep 2005 | A1 |
20050216582 | Toomey et al. | Sep 2005 | A1 |
20050223412 | Nadalin et al. | Oct 2005 | A1 |
20050256924 | Chory et al. | Nov 2005 | A1 |
20050259655 | Cuervo et al. | Nov 2005 | A1 |
20050259674 | Cuervo et al. | Nov 2005 | A1 |
20050262232 | Cuervo et al. | Nov 2005 | A1 |
20050267870 | Everett-Church et al. | Dec 2005 | A1 |
20060010134 | Davis et al. | Jan 2006 | A1 |
20060053048 | Tandetnik | Mar 2006 | A1 |
20060053224 | Subramaniam | Mar 2006 | A1 |
20060069737 | Gilhuly et al. | Mar 2006 | A1 |
20060136590 | Barrett et al. | Jun 2006 | A1 |
20060143688 | Futoransky et al. | Jun 2006 | A1 |
20060185021 | Dujari et al. | Aug 2006 | A1 |
20060277218 | Franco et al. | Dec 2006 | A1 |
20070016949 | Dunagan et al. | Jan 2007 | A1 |
20070050854 | Cooperstein et al. | Mar 2007 | A1 |
20070101258 | Xu et al. | May 2007 | A1 |
20070124693 | Dominowska et al. | May 2007 | A1 |
20070260495 | Mace et al. | Nov 2007 | A1 |
20070261037 | Bendapudi | Nov 2007 | A1 |
20070299857 | Gwozdz et al. | Dec 2007 | A1 |
20070300064 | Isaacs et al. | Dec 2007 | A1 |
20080313648 | Wang et al. | Dec 2008 | A1 |
20090183171 | Isaacs et al. | Jul 2009 | A1 |
20090183227 | Isaacs et al. | Jul 2009 | A1 |
20090187918 | Chen et al. | Jul 2009 | A1 |
20090299862 | Fan et al. | Dec 2009 | A1 |
20090300496 | Fan et al. | Dec 2009 | A1 |
20090327869 | Fan et al. | Dec 2009 | A1 |
20100058293 | Dunagan et al. | Mar 2010 | A1 |
Number | Date | Country |
---|---|---|
1420562 | May 2004 | EP |
Number | Date | Country | |
---|---|---|---|
20070299857 A1 | Dec 2007 | US |