MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

appParams and requestNavigateTo

Last post 05-19-2009 9:40 AM by Test User. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 03-12-2008 9:32 AM

    appParams and requestNavigateTo

    I'm trying to pass some params from my profile surface to my canvas (which is an external iframe), but the parameters are not making it through to my server.

    Is this going to be fixed before launch?

  • 03-12-2008 9:51 AM In reply to

    Re: appParams and requestNavigateTo

     I'm encountering this as well.

    requestNavigateTo works, but gadgets.views.getParams() returns an empty object ({}).  I stepped through the gadgets code and on line 1325 it attempts to grab the params via the 'view-params' key (if (urlParams["view-params"]) {), but according to the debugger the params are storred under the key 'p' (looking at the resulting iframe url confirms this).

     Any idea when this can be fixed?
     

  • 03-12-2008 11:42 AM In reply to

    Re: appParams and requestNavigateTo

    This just started working for me -- it seems the appParams come in JSON-encoded in the GET to the IFrame as 'p'

    Filed under:
  • 03-13-2008 11:02 AM In reply to

    Re: appParams and requestNavigateTo

    The following code currently works (slightly modified from some code that Chad provided earlier):

    <script type="text/javascript">

    function rnt(surface_name){
        var surface_objs = opensocial.getEnvironment().getSupportedSurfaces();
        var surface_obj;
        //for(var i = 0; i < surface_objs.length; i++){
        for(var s in surface_objs){
            if(surface_objsSleep && surface_objsSleep.getName() === surface_name){
                surface_obj = surface_objsSleep;break;
            }
        }

        opensocial.requestNavigateTo(surface_obj, {a: "b"});
    }

    function getparams1() {
    alert(opensocial.getEnvironment().getParams()["a"]);
    }


    </script>


    <button onclick='rnt("profile.left");'>rNT Profile</button>
    <button onclick='rnt("home");'>rNT Home</button>
    <button onclick='rnt("canvas");'>rNT Canvas</button>
    <button onclick='getparams1()'>Params1</button>

     

    --------------

    Note for 0.8 container you must use

      var param_value = gadgets.views.getParams().appParams; 
      //or directly
     
      var a_value = gadgets.views.getParams().a;

     

     

  • 04-18-2008 9:23 AM In reply to

    Re: appParams and requestNavigateTo

     I've discovered that using Safari, the JSON params are mangled and so don't work.

    Double quotes end up being encoded automatically by safari, and that breaks the JSON.

    Trying single quotes causes a myspace error.

    No Quotes apparently doesn't pass the parameters.

     

  • 04-30-2008 4:33 PM In reply to

    Re: appParams and requestNavigateTo

    Chris:

    The following code currently works (slightly modified from some code that Chad provided earlier):

    <script type="text/javascript">

    function rnt(surface_name){
        var surface_objs = opensocial.getEnvironment().getSupportedSurfaces();
        var surface_obj;
        //for(var i = 0; i < surface_objs.length; i++){
        for(var s in surface_objs){
            if(surface_objsSleep && surface_objsSleep.getName() === surface_name){
                surface_obj = surface_objsSleep;break;
            }
        }

        opensocial.requestNavigateTo(surface_obj, {a: "b"});
    }

    function getparams1() {
    alert(opensocial.getEnvironment().getParams()["a"]);
    }


    </script>


    <button onclick='rnt("profile.left");'>rNT Profile</button>
    <button onclick='rnt("home");'>rNT Home</button>
    <button onclick='rnt("canvas");'>rNT Canvas</button>
    <button onclick='getparams1()'>Params1</button>

     I've copied and pasted the above code to OSTool editor but I get the following error on clicking any of the buttons it creates (that is, whenever requestNavigateTo is called). Also, getParams is returning undefined instead of the param passed across the surface. I'm using Firefox.

    remote_relay_url has no properties
    http://api.msappspace.com/OpenSocial/references/ifpc001.js
    Line 176

    What am I missing? Confused

  • 05-06-2008 11:44 AM In reply to

    • Jeff
    • Not Ranked
    • Joined on 02-21-2008
    • Posts 8

    Re: appParams and requestNavigateTo

    should this be using the gadgets stuff instead of the opensocial stuff? http://developer.myspace.com/Community/forums/p/521/2026.aspx#2026 shows something similar but it uses gadgets code. am i missing some clear direction you folks have provided somewhere about what should be used and what should not?
  • 05-06-2008 11:58 AM In reply to

    Re: appParams and requestNavigateTo

    Yeah, Jeff, it really should. The code examples above are from the old 0.6 OpenSocial implementation, which is being yanked. Use the 0.7 version, from the gadgets specs.

  • 05-19-2009 9:40 AM In reply to

    Re: appParams and requestNavigateTo

    note: For 0.7 and 0. use:

      var param_value = gadgets.views.getParams().appParams; 
      //or directly
     
      var a_value = gadgets.views.getParams().a;

     

     

Page 1 of 1 (9 items)