Hey Chris, Yeah, the IFRAME security model is blocking you. To get around this, any querystring parameter prefixed with "up_" will be passed to your application as a user preference value.
For example, going to http://sandbox.orkut.com/Application.aspx?appId=xx&up_hello=hi (where xx is your application's ID number) will forward the up_hello parameter to your application as a UserPref named hello. You can retrieve this in the following manner: var prefs = new _IG_Prefs(); //Sets a variable named hello to the value of the up_hello querystring param var hello = prefs.getString("hello"); We're bringing linking to different modes/pages/user contexts into the API, but for right now, you should be able to manually create links to pass data to your app. ~Arne On Dec 4, 8:26 pm, Chris Chabot <[EMAIL PROTECTED]> wrote: > Maybe this is the wrong place to ask this, i'm not sure if the > question is the same, but it sounds somewhat similar to my problem. > > What i want to do is have clickable links on my gadget view page, > which link to the canvas view page, with the page for the selected > element shown. > > To accomplish this i've first retrieved the appId (thru some silly > hacks, more on this later), and then i retrieved the UID for the link > (more silly hacks, more on this later too). With it i have now > constructed a valid /Application.aspx?appid=abc&uid=def link, set > target to _top ... and presto, a link to the canvas page. > > However the trouble i already ran into before, is that if i do a : > console.log(window.parent.location); > everything is peachy ... however a: > console.log(window.parent.location.search); > makes firefox stop @ that code ... presumably this is the cross domain > security, since the iframe of the gadget is on a different domain then > orkut.com, so access might be restricted right? > > I've worked around this problem of getting the UID from the > parent.location by abusing the owner's profile URL and doing > a .replace('Profile','Application') on it, to hack a valid URL > together ... this of course isnt really a viable long term solution > but a bad hack. > > Now i'm running into the same problem again, since i want to add a > "&selected=ghij" to the URL, and in my open social application, use > this value to know what i should be showing ... but i can't access it > properly without firefox interrupting the javascript execution due to > the cross domain issues.. > > So my question comes down to: > > How to make a link to: > > /Application.aspx?uid=ABC&appid=def&selected&ghi > > and how to access the selected get param? or is this simply not > possible at the moment? > > It's kind of important for the design of the application flow choices > for me :-) > > oh and about the silly hack for the appid ... i should be able to do > something like: > var stream = response.get('activities'); > var appId = stream.getField(opensocial.Stream.Field.APP_ID); > > this fails because .getField() isnt a function on this object so i > looked @ the stream object and hacked around it by using: > var stream = response.get('activities'); > var appId = stream.getData().requestedStream.params.appId; > > dirty as can be, and very much not intended i think, however it works > for now until there's new docs on what to do, or the original example > works :-) If anyone has a cleaner solution i'd be much obliged. > > Regards, > > -- Chris Chabot > > On Dec 3, 2007, at 12:52 PM, aplicativos.globo wrote: > > > > > Hello, > > > If got it right you want to link to your app in canvas/profile to a > > specific "page" of your app. > > > If you're using your gadget as html content, the API will place your > > code in an iframe therefore if you create the link you need and use > > window.parent.location you'll get the browser to open the link you > > created, if you only use window.location you get the result you > > described. > > > Did it help? > > > Vanessa. > > > On Dec 3, 5:26 am, nands <[EMAIL PROTECTED]> wrote: > >> Hi , > >> I'm trying to link the multiple pages of my application on the > >> canvas. > >> I tried using the tip where one or more arguments could be passed and > >> the passed values could be used to load a new page. > >>http://sandbox.orkut.com/Application.aspx? > >> appId=<your_application_id>&up_path=about > > >> Now this link was a href so when click, the complete container page > >> (in my case Orkut ) page opens inside my canvas.Basically the full > >> orkut page opens up inside another...which is not what we want here. > > >> I need a way to browse through the multiple pages of the application > >> easily and if possible pass a few values using GET. > > >> One way I thought of is that we put the full html code of every page > >> in seperate div elements in a single file and hide/unhide them or > >> fetch data to populate them as and when required depending on user > >> actions through javascript handlers. This renders the page static. > > >> Otherway I have figured out is the fetch data from _IG_FetchContent > >> and use innerHTML inside specific sections of my page to load > >> complete > >> html retrieved from remote server. In this case all the hrefs will be > >> handled by onclick javascript functions. > > >> Lastly, we can do it dynamically using createElement and removeChild > >> methods to generate the complete page. > >> These all seem to work but are not convincing.. is there a > >> better way to do it ? > >> Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "OpenSocial API Definition" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/opensocial-api?hl=en -~----------~----~----~----~------~----~------~--~---
