The NavigationLocation
object used in the navigate
and open
method is in preview and is supported only in Confluence and Jira.
We release preview features so partners and developers can study, test, and integrate them prior to General Availability (GA). For more information, see Forge release phases: EAP, Preview, and GA.
The router
object enables you to navigate the host product to another page. router
supports three
methods:
navigate
, which navigates to the page in the same tab.open
, which opens the page in a new tab or window, depending on the user’s browser configuration.reload
, which reloads the current page.For navigate
and open
, there are two ways to declare the target page:
NavigationLocation
(Preview), consisting of the target location and the corresponding properties.Passing a NavigationLocation
(Preview) object enables navigation with contextual and more human-readable data,
rather than using a URL. For a list of supported target locations, see Target locations and properties.
The navigate
method allows you to navigate to a page in the same tab.
1 2function navigate(url: string | location: NavigationLocation): Promise<void>;
The shape of NavigationLocation
(Preview) will vary according to the target location. Required
properties for each target location are defined in Target locations and properties.
If you’re using a URL to link to an external site, the user is prompted before opening the link
in a new tab. If the user declines to proceed, the returned Promise
is rejected. If you’re using
relative URLs (starts with /
), the user won’t be prompted.
1 2import { router, NavigationTarget } from '@forge/bridge'; // To navigate to the view page for a piece of content in Confluence: router.navigate({target: 'contentView', contentId: '12345'}); // To navigate to the view page for version 2 of a piece of content in Confluence: router.navigate({target: 'contentView', contentId: '12345', version: 2}); // To navigate to the edit page for a piece of content in Confluence: router.navigate({target: 'contentEdit', contentId: '12345'}); // To navigate to the page of the given module key: router.navigate({target: 'module', moduleKey: 'my-global-page'}); // To navigate to the issue view page of an issue in Jira: router.navigate({target: 'issue', issueKey: 'TEST-1'}); // Alternatively, `NavigationTarget` can be imported and used for improved IDE autocompletion and documentation support: router.navigate({target: NavigationTarget.Issue, issueKey: 'TEST-1'});
The open
method allows you to open a page in a new tab or window, depending on the user’s browser configuration.
1 2function open(url: string | location: NavigationLocation): Promise<void>;
The shape of NavigationLocation
(Preview) will vary according to the target location. Required
properties for each target location are defined in Target locations and properties.
If you’re using a URL to link to an external site, the user is prompted before opening the link
in a new tab. If the user declines to proceed, the returned Promise
is rejected. If you’re using
relative URLs (starts with /
), the user won’t be prompted.
1 2import { router, NavigationTarget } from '@forge/bridge'; // Opens the view page for a piece of content in Confluence in a new tab or window: router.open({target: 'contentView', contentId: '12345'}); // Opens the issue view page of an issue in Jira in a new tab or window: router.open({target: 'issue', issueKey: 'TEST-1'}); // Alternatively, `NavigationTarget` can be imported and used for improved IDE autocompletion and documentation support: router.open({target: NavigationTarget.Issue, issueKey: 'TEST-1'});
The reload
method allows you to reload the host window.
1 2function reload(): Promise<void>;
1 2import { router } from '@forge/bridge'; router.reload();
A NavigationLocation
is a specific target within Confluence, Jira, or directory that can be
navigated to using the navigate
or open
methods. It consists of a target location and its
corresponding properties, which are outlined below.
contentView
The view page for pages, blogs, and custom content.
To navigate to /wiki/pages/viewpage.action?pageId=238945&pageVersion=2
:
1 2router.navigate({target: 'contentView', contentId: '238945', version: 2});
Property | Required | Description |
---|---|---|
contentId | Yes | The ID of the content. |
version | No | If provided, will navigate to the specified version. |
contentEdit
The edit page for pages, blogs, and custom content.
To navigate to /wiki/spaces/${spaceKey}/pages/edit-v2/238945
:
1 2router.navigate({target: 'contentEdit', contentId: '238945'});
Property | Required | Description |
---|---|---|
contentId | Yes | The ID of the content. |
spaceView
The space view page.
To navigate to /wiki/spaces/TEAM
:
1 2router.navigate({target: 'spaceView', spaceKey: 'TEAM'});
Property | Required | Description |
---|---|---|
spaceKey | Yes | The key of the space. |
contentList
The list page for pages, blogs, and custom content in a space.
To navigate to /wiki/spaces/TEAM/pages
:
1 2router.navigate({target: 'contentList', contentType: 'page', spaceKey: 'TEAM'});
To navigate to /wiki/search?type=forge:${appId}:${environmentId}:my-custom-content-module
:
1 2router.navigate({target: 'contentList', contentType: 'customContent', moduleKey: 'my-custom-content-module'});
Property | Required | Description |
---|---|---|
contentType | Yes | The content type. Accepts:
page ,blogpost , orcustomContent |
spaceKey | Yes, if contentType is page or blogpost . | The key of the space. |
moduleKey | Yes, if contentType is customContent . | The module key of the page. |
module
The page containing the supported module. Supported Confluence modules:
To navigate to /wiki/apps/${appId}/${environmentId}/${route}
:
1 2router.navigate({target: 'module', moduleKey: 'my-global-page'});
Property | Required | Description |
---|---|---|
moduleKey | Yes | The module key of the page. |
spaceKey | Yes, if using:
| The key of the space. |
dashboard
A dashboard in Jira.
To navigate to /jira/dashboards/10000
:
1 2router.navigate({target: 'dashboard', dashboardId: '10000'});
Property | Required | Description |
---|---|---|
dashboardId | Yes | The ID of the dashboard. |
issue
An issue in Jira.
To navigate to /browse/FT-3
:
1 2router.navigate({target: 'issue', issueKey: 'FT-3'});
Property | Required | Description |
---|---|---|
issueKey | Yes | The key of the issue. |
projectSettingsDetails
The details of a Jira project. Only accessible to administrators.
To navigate to /jira/software/projects/FT/settings/details
:
1 2router.navigate({target: 'projectSettingsDetails', projectKey: 'FT'});
Property | Required | Description |
---|---|---|
projectKey | Yes | The key of the project. |
module
The page containing the supported module. Supported Jira modules:
To navigate to /jira/settings/apps/${appId}/${environmentId}
:
1 2router.navigate({target: 'module', moduleKey: 'my-admin-page'});
Property | Required | Description |
---|---|---|
moduleKey | Yes | The module key of the page. |
projectKey | Yes, if using:
| The key of the project. |
userProfile
The profile page for a specific user.
To navigate to /people/12345
:
1 2router.navigate({target: 'userProfile', accountId: '12345'});
Property | Required | Description |
---|---|---|
accountId | Yes | The ID of the user account. |
Rate this page: