MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

Easy way to link to VIEWER's profile from canvas?

Last post 07-01-2008 11:12 AM by Zoasterboy. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 06-30-2008 12:20 PM

    • Jessie
    • Not Ranked
    • Joined on 02-21-2008
    • Posts 5

    Easy way to link to VIEWER's profile from canvas?

    I've submitted and resubmitted my app to MySpace and they came back saying a link to the VIEWER's profile on the canvas page was not working, even though I tested it in every relevant browser and found no such issue. For now I'm just removing the link. Can anyone demonstrate for me an easy way to produce a link to the VIEWER's profile from a canvas page? I feel like this should be a really easy, foolproof thing to do but apparently that's not the case.
  • 06-30-2008 12:40 PM In reply to

    Re: Easy way to link to VIEWER's profile from canvas?

    Here is a simple example, just grab the viewers profile URL and add the HTML tags

    <div id='main'></div> 

    <script type='text/javascript'>

    var os;
    var dataReqObj;
    var html = '';

    function init() {
    os = opensocial.Container.get();
    dataReqObj = os.newDataRequest();
    var viewerReq = os.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER);
    dataReqObj.add(viewerReq);
    dataReqObj.send(viewerResponse); //Send request for viewer data
    }

    function viewerResponse(data) {
    if (data.hadError()) {
    var data2 = data.get(opensocial.DataRequest.Group.VIEWER_FRIENDS);
    alert(data2.getErrorCode() + '\n' + data2.getErrorMessage());
    }
    else {
    var viewer = data.get(opensocial.DataRequest.PersonId.VIEWER).getData();
    var profile = viewer.getField(opensocial.Person.Field.PROFILE_URL);
    html = "<a href='" + profile + "'>Click here to view your profile!</a>"
    document.getElementById('main').innerHTML = html;
    }
    }

    init();

    </script>

     

  • 06-30-2008 1:18 PM In reply to

    • Jessie
    • Not Ranked
    • Joined on 02-21-2008
    • Posts 5

    Re: Easy way to link to VIEWER's profile from canvas?

    That's more or less exactly what I had. I don't know why it's not working for them. Gr. With Facebook, something like this is as easy as <fb:name uid="<%= params[:fb_sig_user] %>"/>. One line. Simple. With MySpace you have to initialize all these request objects and have a callback function just to get something so trivial. I know they're still working on it but this just doesn't seem like the right direction.
  • 06-30-2008 5:50 PM In reply to

    Re: Easy way to link to VIEWER's profile from canvas?

     Yes, I've always thought the OpenSocial API was unnecesarily bloated... but it's what we have to work with. It's still in it's infancy, so hopefully it streamlines over time.

     You should probably post the information on why your app was rejected along with your app id in the App Denied, Need Clairification forum.

  • 07-01-2008 10:45 AM In reply to

    Re: Easy way to link to VIEWER's profile from canvas?

    hey Zoasterboy,

    I appreciate your posts.  It's funny though, I am new to apps and have just got my developer account working after 6 weeks, so I have been reading through the lit. I just got my FaceBook account setup, too, and I have exactly the opposite response.

    MySpace is young, using new technologies and shoehorning them together, but the system is rational, predictable, and shows conscious design.  The FaceBook system is one massive kludge, full of bizarre hacks like renaming all the JavaScript objects and nothing works until the user's first click.  It is childish and primitive in comparison.

    Creating a backend that will work with both of them seamlessly is going to be a challenge. 

    Remember, bloat never goes away, nothing is ever streamlined, and the second law of thermodynamics is a farce. 

  • 07-01-2008 11:12 AM In reply to

    Re: Easy way to link to VIEWER's profile from canvas?

     

    Christopher L.:

    The FaceBook system is one massive kludge, full of bizarre hacks like renaming all the JavaScript objects and nothing works until the user's first click.  It is childish and primitive in comparison.

    ...

    Remember, bloat never goes away, nothing is ever streamlined, and the second law of thermodynamics is a farce. 

     Ah I see, I haven't had much FaceBook development experience, just seeing code snippets here and there. I always thought their site was a bit of a kludge, I did'nt know they carried it over to development haha

     And I like that last sentance! Mind if I quote you here and there? ;)

Page 1 of 1 (6 items)