MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

Getting the URL of the current page (or the app id)

Last post 10-29-2008 10:28 AM by Chad Russell. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-28-2008 1:42 AM

    Getting the URL of the current page (or the app id)

    In our app we need to be able to build urls for the app pages so that we can build external links to them. An acute case for this is for YouTube video uploads, where the upload action needs a link-back url where it sends the user after the upload.

    I can see basically two ways to get the url:

    1. Get the current URI (and replace parts of it if needed) and send it along the request. This has the problem that since our app runs in an iframe and from a different domain than the main window, javascript isn't allowed to access the url of the main window.
    2. Get the current application id. Is there a way to get to the id within the JS api? If we'd be able to get the app id, building the url would be trivial. Unfortunately, unlike the main window url, the iframe url (http://api.msappspace.com/apprendering/render.app...) does not include the app id, so it seems the only place where it is is the id of the iframe element (apppanel_XXXX_canvas). Fetching the app id from there seems way too brittle and hackish, but is there any better way?
    Filed under: , , ,
  • 10-29-2008 10:28 AM In reply to

    Re: Getting the URL of the current page (or the app id)

     Try:

    gadgets.views.getParams().appid; 

Page 1 of 1 (2 items)