Redirecting user to other page and directly envoking a Plug-In

Hi there,
i am looking to implement something for the cloud version of our app that was easily possible in the Confluence Server environment:

  • I want to offer the user a link, and if pressed, the user should be redirected to a dialog of our App on another Confluence page. In the server version, this dialog would for example be a […].action url. In Cloud, however, since the apps are in Iframes, it is not easily possible to send the user to the other Confluence page and directly envoking our macro there. By now, i can only link to the other Confluence page, and the user would have to interact with our macro to open the dialog i want to show.

How is it done in Confluence Cloud?

Thank you

Hi @phil,

I don’t think there’s a “native” feature for this, but you can probably make this work using a workaround. Note that this definitely a bit hacky and I’m not sure whether you’d want to have something like this in an app that you’re selling on the Marketplace.

The workaround I’m thinking of, would be to have an iframe that is always rendered, can check for URL parameters, and is thereby able to open a dialog accordingly.

The steps to do this would be:

  • Have a web-panel e.g. in the atl.footer location that essentially only loads JS and doesn’t render anything (and is therefore “hidden”).
  • Inside this web-panel, use AP.getLocation to get the URL of the page the user is visiting.
  • If the URL matches a condition (e.g.: if it contains a ?open-my-dialog=true parameter) then you can open a Connect dialog using the JavaScript Dialog API.

Example pseudo code:

AP.getLocation(url => {
  if (matchesYourCondition(url)) {
    AP.dialog.create({key: 'my-module-key', ...});
  }
});

Hope this helps!

Cheers,
Sven

EDIT: I just realized that you only want to do this from a macro? Is that correct? In that case you could just have this JavaScript in your macro which would of course be much better than having a hacky web panel like I mentioned above. :slight_smile:

1 Like