#summary Using RPC for gadget/iframe communication ==IMPORTANT:== ===gadgets.rpc is not designed to enable application developers to execute OpenSocial functions from remote containers. The below method is not secure and does not work reliably across containers or browsers and hence the library will not be supported for this purpose.=== ====Developers looking to integrate remote pages with OpenSocial containers should either use makeRequest to fetch their markup and display it directly within the application or wait for their container to release a REST API.==== ---- ---- = Introduction = Gadgets that rely heavily on content from a single site are faced with an unfortunate dilemma — whether to bundle up the content into a form that can be requested with makeRequest, or to forgo use of the !OpenSocial API entirely, and just open an iframe to the other site. Fortunately, these aren't the only options available. Thanks to the gadgets.rpc library, gadgets can open iframes to external sites without losing contact with their parent containers. = Details = ==The alert gadget== The alert gadget is a trivial use of the gadgets.rpc library, but nicely demonstrates how the library works. The gadget's purpose is to create an iframe containing HTML on a different domain. This HTML contains a simple button, called "Alert!" that when clicked displays two alert messages. The first message is called directly within the iframe (the "local" alert). The second message is called by sending a message back to the parent container (the "remote" alert, inside of the gadget). Actual implementation of this gadget is fairly straightforward. Start, by creating a simple gadget XML file, including and including the necessary JavaScript. {{{ var auth = "password"; gadgets.rpc.register("remote_alert", function(msg, auth_key) { if (auth_key == auth) { alert(msg); } });