Yes, but only if you know the following:
- Where to get scripts from the parent page.
- Where the ifpc relay for the parent page is.
To make this work today in a secure manner you must do the following:
- Maintain a list of mappings between syndicator codes to host data. This
should include the following:
- The ifpc / rpc relay file location for the given syndicator
- The path to fetch javascript from the given syndicator.
It would look something like this, in JSON format:
"example.org" : {
"relayUrl" : "http://www.example.org/relay.html",
"javascript" : "http://www.example.org/js/"
}
You could now make the following assumptions based upon a combination of the
"synd" and "libs" parameters passed into your iframe:
- synd: tells you what syndicator is in use (note: this is NOT currently
standardized, but I plan on proposing it to the standards discussion group
in the near future). This will typically be a domain name.
- libs: tells you want libraries the syndicator needs you to load in order
to render your gadgets (note: there's really no compelling reason to require
this today since you, as the gadget author, should already know what
libraries you need.)
To set preferences in the parent page, you need to invoke the ifpc / rpc
service "set_pref" (which the "setprefs" feature will do for you
automatically). This involves opening an iframe on the same domain as the
parent page pointing at the appropriate ifpc / rpc relay file and passing
the data in.
Now, you're probably thinking "that sounds like a lot of work!", and you're
correct. I'd strongly recommend not designing type=url gadgets to use
setprefs if you can avoid it, and instead try storing the data on your own
server. Cookies can be used in a third-party domain as long as you have a
privacy policy that allows it and you set appropriate P3P headers in your
output. This technique is discussed in detail in the legacy igoogle gadgets
documents, found here:
http://code.google.com/apis/gadgets/docs/fundamentals.html#Cookies
Even better alternative: One goal of opensocial is robust RESTful
server-side APIs. As these APIs are fleshed out and we have implementations
of them in shindig, there should be better solutions.
Final recommendation: Avoid writing type=url gadgets unless you only care
about working on one specific container site. Security and maintenance is
far too difficult otherwise.
On Feb 19, 2008 10:12 PM, Neo Anderson <[EMAIL PROTECTED]>
wrote:
> I'm using type="url" gadgets. Is there any way of saving preferences?
>
>
>
> On Feb 19, 2008 11:39 PM, Bruno Bowden <[EMAIL PROTECTED]> wrote:
>
> > Too true about the bug. I mean to be talking about open syndication (i.e
> .
> > hosting gadgets on 3rd party sites that aren't full blown containers).
> >
> > On Feb 19, 2008 9:55 AM, Kevin Brown <[EMAIL PROTECTED]> wrote:
> >
> > > On Feb 19, 2008 3:17 AM, Bruno Bowden <[EMAIL PROTECTED]> wrote:
> > >
> > > > Depends on how the container supports gadgets.prefs_. In iGoogle's
> > case
> > > > for
> > > > example, the settings are stored with the settings for iGoogle. For
> > now
> > > > simplecontainer could (but doesn't yet) store them in a cookie. For
> > type
> > > > url
> > > > gadgets, the settings aren't stored at all.
> > >
> > >
> > > That's not quite correct. There is an outstanding but on igoogle that
> > has
> > > prevented prefs from being saved for type=url gadgets, but it is
> > intended
> > > that they be saved.
> > >
> > >
> > > >
> > > > On Feb 18, 2008 11:18 PM, Arun Kumar <
> [EMAIL PROTECTED]>
> > > > wrote:
> > > >
> > > > > Assume that I have a gadget with xml as:
> > > > >
> > > > > <?xml version="1.0" encoding="UTF-8" ?>
> > > > > <Module>
> > > > > <ModulePrefs title="Preferences for __UP_myname__" height="250"
> />
> > > > > <UserPref name="mychoice" display_name="List Params?"
> > > datatype="bool"/>
> > > > >
> > > > > <UserPref name="myname" display_name="Name" required="true"/>
> > > > > <UserPref name="mycolor" display_name="Color"
> default_value="Blue"
> > > > > datatype="enum">
> > > > >
> > > > > <EnumValue value="Red"/>
> > > > > <EnumValue value="Blue"/>
> > > > > <EnumValue value="Green"/>
> > > > > <EnumValue value="Yellow"/>
> > > > >
> > > > > <EnumValue value="Pink"/>
> > > > > <EnumValue value="Orange"/>
> > > > > <EnumValue value="White"/>
> > > > > </UserPref>
> > > > >
> > > > > <Content type="url" href="http://www.example.com/params.php"/>
> > > > > </Module>
> > > > >
> > > > >
> > > > > In I run this gadget and click on settings button, then I will get
> a
> > > > > check box, text box and a drop down list.
> > > > > When I change these fields values and click on Save, to which URL
> > > > > these values will be posted to?
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > ~Kevin
> > >
> > > If you received this email by mistake, please delete it, cancel your
> > mail
> > > account, destroy your hard drive, silence any witnesses, and burn down
> > the
> > > building that you're in.
> > >
> >
>
--
~Kevin
If you received this email by mistake, please delete it, cancel your mail
account, destroy your hard drive, silence any witnesses, and burn down the
building that you're in.