Page 1 of 1

Atrium detection

Posted: Wed Apr 02, 2014 4:07 pm
by SeanTyree
Is there any way to tell if a ProfoundUI program is running within Atrium?
I want to respond to a button click with Atrium.launchURL when the user is running inside of Atrium and pui.openURL when not running Atrium.

Thanks,
Sean

Re: Atrium detection

Posted: Wed Apr 02, 2014 4:10 pm
by David
You can determine that with this bit of JavaScript:

Code: Select all


if (parent != window && parent.Atrium) {

  // Running inside Atrium.

}

The first condition checks to see if you are running in a frame. The 'parent' will be the same as 'window' when not running in a frame, but will be set to the parent page's 'window' when running inside a frame. The 2nd condition checks to see if the parent page has a property called 'Atrium', which then indicates that you are inside Atrium.

Re: Atrium detection

Posted: Wed Apr 02, 2014 5:59 pm
by SeanTyree
Thanks David!
Worked like a charm.

Sean