Is there a way to pass request parameters from the main Confluence Cloud URL into a macro or web panel?

I’d like to get ahold of certain request parameters from the main Confluence Cloud application and pass them through to a web panel or macro.

Back in the early days of Atlassian Connect, you would simply call document.referrer to get hold of any request parameter.

Currently this is not possible because every iframe has the referrer-policy="no-referrer" attribute which blocks this.

Is there an API call that I can get this from which would return the current URL including request parameters?

2 Likes

You’ll need to do it on the client side using AP.getLocation():
https://developer.atlassian.com/cloud/jira/platform/jsapi/ap/

(I should probably note that it’s more than likely frought with danger doing it - but it’s the only way to get hold of the current location).

1 Like

I would probably suggest putting in a feature request (somewhere) and then hope…

2 Likes

Edit: I used a subtly different API call AP.navigation.getLocation() rather than AP.getLocation()


Oh man, thats a shame, because for Confluence Cloud, AP.getLocation() AP.navigation.getLocation() returns something like this:

{
	"target": "contentview",
	"context": {
		"contentId": 491543,
		"contentType": "page",
		"spaceKey": "ABC123"
	}
} || null

It doesn’t tag on any request parameters anywhere - just the bare facts for that page.

Whereas, what @daniel said is absolutely correct:

AP.getLocation() returns the full URL:

https://example.atlassian.net/wiki/spaces/GAN/pages/26476621/Example+page?xxx=yyy