Skip to main content

Navigation

getTopOrigin()

Returns a promise that resolves with the origin of the top window. Useful for navigating in Suite from iframes.

Usage: window.e.utils.v2.navigation.getTopOrigin()


getTopUrl()

Returns a promise that resolves with the full URL of the top window.

Usage: window.e.utils.v2.navigation.getTopUrl()


getRouteUrl({ namespace, action, params })

Builds and returns a URL by target. Useful for constructing links.

Usage: window.e.utils.v2.navigation.getRouteUrl({ namespace, action, params })

Parameters

NameTypeRequiredDescription
namespacestringyesName of the route group
actionstringyesName of the target (can be empty)
paramsobjectnoParameters the target needs

Example

const url = await window.e.utils.v2.navigation.getRouteUrl({
namespace: 'email_campaigns',
action: 'edit',
params: { campaign_id: '1' }
});

Navigates the browser's main window to a prespecified URL.

Usage: window.e.utils.v2.navigation.navigateToRoute({ namespace, action, params })

Parameters

NameTypeRequiredDescription
namespacestringyesName of the route group
actionstringyesName of the target (can be empty)
paramsobjectnoParameters the target needs

Example

window.e.utils.v2.navigation.navigateToRoute({
namespace: 'email_campaigns',
action: 'edit',
params: { campaign_id: '1' }
});

topHash

Lets an app in an iframe listen for hashchange events on the top window and update the top hash.

Methods

MethodDescription
topHash.addEventListener(callback)Registers a callback for each top-window hashchange event
topHash.removeEventListener(callback)Unregisters the callback
topHash.update(hash)Updates the top window URL hash

unload.init(options) / unload.reset()

Prevents accidental navigation (e.g. when there are unsaved changes) by showing a Confirmation Dialog.

Usage: window.e.utils.v2.navigation.unload.init(options) / window.e.utils.v2.navigation.unload.reset()

Options (all optional)

NameDefaultDescription
headline"Confirm Navigation?"Dialog headline
content"Your unsaved changes will be lost."Dialog content
confirm"Continue"Confirm button label
cancel"Cancel"Cancel button label

Example

if (isCampaignDirty) {
window.e.utils.v2.navigation.unload.init();
} else {
window.e.utils.v2.navigation.unload.reset();
}

getHelpPortalUrl({ articleId, articleAnchor })

Returns the edition-specific Help Portal URL for a given article.

Usage: window.e.utils.v2.navigation.getHelpPortalUrl({ articleId, articleAnchor })

Parameters

NameTypeRequiredDescription
articleIdstringyesID of the help portal article
articleAnchorstringnoAnchor within the article

Example

const url = await window.e.utils.v2.navigation.getHelpPortalUrl({
articleId: 'fdf2e60e74c11014a81ee05ad954b102',
articleAnchor: 'email-content-check'
});