So before I start... I'll say that most of this DID NOT all come from
the spec.. but from trial and error and firebug. So don't blame me if
these methods break when they fix all the Orkut errors.

Eugene: With reference to 'Maps', at this point it looks like the code
is expecting { contentType:"json" } or similar (see the orkut 0.6
iframe source code line 592). If you dig into the code there is only
mention of contentType "json" or contentType "dom" or default... which
is 'as is'. The identifier is 'contentType', in the current code at
least.

I was finally able to get some simple text data through... but not
without jumping through a bunch of hoops:

First notice on the source line 584 that the text coming back from
your server is trimmed, so any string that comes from your server must
be prefixed with "throw 1; < don't be evil' >" (or 27 characters) that
will be auto-trimmed. ("throw 1; < don't be evil' >" is the string
that they use to trim the text... see lines 565 & 584 of the source.
The note in the source code implies that this won't be an issue for
long.)

Next thing is that their code expects your server to output a JSON
object. Not only that, but the object should contain a property named
with the url of the requested file (unescaped) containing a property
named 'body' that contains the textual data. (who knew?)

Here's what the output string i tested with looks like (in php):

echo "throw 1; < don't be evil' >{ 'http://www.iwiddit.com/test.php' :
{ 'body' : 'this is a test' } }";

Here's what the request (app code) looked like:

            var url = 'http://www.iwiddit.com/test.php';
            var params = { contentType:"html" }; // this will call
default in the switch statement (redundant)
            opensocial.makeRequest( url, retDat, params );

            function retDat( dat ){
                    document.body.innerHTML += dat;
            }

The result was as expected... on orkut (yes it works).

The file I used for testing is at www.iwiddit.com/testing/make_request.xml
The output from my server can be seen at 
www.iwiddit.com/testing/make_request.php
The contents of the php file can be seen here 
www.iwiddit.com/testing/make_request.txt

*** Obviously if you decide to implement with these methods (I
wouldn't until you hear it from Google, otherwise it'll probably break
soon.), you'll have to make sure the url in the returned data matches
yours... if you look at the source of the current 0.6 iframe (lines
565 - 616) you'll understand why...

Hope all that helps some,

-Dustin / www.iWiddit.com



On Jan 16, 11:07 pm, ejpark <[EMAIL PROTECTED]> wrote:
> So I'm calling:
> opensocial.makeRequest(MY_URL, MY_CALL_BACK);
>
> The request successfully reaches my server, but upon return, the
> container tries to parse my response as javascript.  How do I set this
> to html?
>
> The spec says that 'opensocial.makeRequest' accepts a third parameter
> to set ContentType, AuthenticationType, etc.  Any examples on how to
> setup this third parameter?
>
> Eugene
> Flixster, Inc.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Discussion" group.
To post to this group, send email to opensocial-orkut@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to