How To Use requestNavigateTo() on MySpace
March 12th, 2008 by ErikTwo MySpace developers posting on a thread regarding requestNavigateTo within the MySpace environment need credit for this one. Kristaps and Eric posted a discussion which included some nice brief code snips. The code is short and sweet. All that’s required is a surface name and any optional parameters you would want to pass to that surface. Note in OpenSocial 0.7 “surfaces” are now known as “views” which might throw some developers for a loop as they make the transition.
function navigate(surfaceName, params){
var surfaces = gadgets.views.getSupportedViews();
var surfaceRef = surfaces[surfaceName];
gadgets.views.requestNavigateTo(surfaceRef, params);
}
Valid views within MySpace (as of this time) are home, profile, and canvas. Sample usage for moving to the Canvas view from the profile (or home) would be as follows:
<a href="#na" onClick="navigate('canvas',{});" title="Move to canvas">go to canvas</a>
Tags: myspace, opensocial, requestNavigateTo