How to get base URL of Jira from forge app?

I want to fetch base URL of JIRA from Admin page of forge app. I tried using all window’s tag. But it is returning forge app location that is iFrame.

  console.log('urlParams location  -->' +  window.location);
  console.log('urlParams href-->' +  window.location.href);
  console.log('urlParams history-->' +  JSON.stringify(window.history));
  const searchParams = new URLSearchParams(window.location);
  const searchParams1 = new URLSearchParams(window.location.href);
  const searchParams2 = new URLSearchParams(window.history);

Hi @Gowrish
In Custom UI try using the context API:
view.getContext

It returns an object with multiple fields, including:

siteUrl – The URL of the site where the app is installed (e.g., https://example.atlassian.net).

1 Like

@andrei-pisklenov Thanks for suggestion. I tried this, but it is only returning site details. But i want fetch the entire URL. Can you please help me on this?

My Sample URL - https://example-dev.atlassian.net/jira/settings/apps/e24a9c76-d19e-55b3-fff5b-d8984f4ce930/?code=aasdfghjjhgfdsxcvbnjhgfdwertyuytr

Herethe siteURL returning only https://example-dev.atlassian.net
but i want to fetch URLparams like code details from the URL

You can access the current URL parameters using the createHistory API.

@andrei-pisklenov Thanks a lot. I am able to fetch it.