Inline Versus Proxy Content

As you have seen, the Content section may contain either inline content—including HTML, CSS, and JavaScript—or you may use a proxy file to load the content. This proxy file, which is the URL value of the href attribute, needs to be a file of type HTML, XHTML, PHP, or any other server-side language. The proxy cannot be, for instance, a link to a .swf Flash file, an image, or a .mov QuickTime movie. To embed these items, you must wrap them in an HTML document and serve them via that file.

“Is it better to inline your content or have a proxy?” is usually one of the first questions that comes up when developers start building their applications. As far as the accessibility of container-specific features, there are really no differences between the two methods. When a gadget is rendered, all Content sections are concatenated together in a similar fashion. Choosing one method over another really comes down to maintainability, number of server requests, and load time.

Most containers internally cache the gadget XML files that are uploaded to their systems so they can serve up gadgets quickly. Once you make edits to a gadget XML file, these containers will require you to reupload or update their cache by syncing the XML file. This can be a tedious task depending on how the container handles caching, and if you inline your content inside the gadget XML file, you will have to do it each time you wish to view edits.

On the other hand, if you proxy your content using ...

Get Programming Social Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.