Edit

BrowserUtils module

Functions

addClientCapabilitiesToClaims(string, string[])
blockAcquireTokenInPopups()

Block redirectUri loaded in popup from calling AcquireToken APIs

blockAPICallsBeforeInitialize(boolean)

Throws error if initialize hasn't been called

blockNonBrowserEnvironment()

Throws error if token requests are made in non-browser environment

blockRedirectInIframe(boolean)

Block redirect operations in iframes unless explicitly allowed

blockReloadInHiddenIframes()

Throws error if we have completed an auth and are attempting another auth request inside an iframe.

clearHash(Window)

Clears hash from window url.

createGuid()

Wrapper function that creates a UUID v7 from the current timestamp.

getCurrentUri()

Returns current window URL as redirect uri

getHomepage()

Gets the homepage url for the current window location.

isInIframe()

Returns boolean of whether the current window is in an iframe or not.

isInPopup()

Returns boolean of whether or not the current window is a popup opened by msal

preconnect(string)

Adds a preconnect link element to the header which begins DNS resolution and SSL connection in anticipation of the /token request

preflightCheck(boolean)

Helper to validate app environment before making an auth request

redirectPreflightCheck(boolean, BrowserConfiguration)

Helper to validate app enviornment before making redirect request

replaceHash(string)

Replaces current hash with hash from provided url

Function Details

addClientCapabilitiesToClaims(string, string[])

function addClientCapabilitiesToClaims(claims?: string, clientCapabilities?: string[]): string

Parameters

claims

string

clientCapabilities

string[]

Returns

string

blockAcquireTokenInPopups()

Block redirectUri loaded in popup from calling AcquireToken APIs

function blockAcquireTokenInPopups()

blockAPICallsBeforeInitialize(boolean)

Throws error if initialize hasn't been called

function blockAPICallsBeforeInitialize(initialized: boolean)

Parameters

initialized

boolean

blockNonBrowserEnvironment()

Throws error if token requests are made in non-browser environment

function blockNonBrowserEnvironment()

blockRedirectInIframe(boolean)

Block redirect operations in iframes unless explicitly allowed

function blockRedirectInIframe(allowRedirectInIframe: boolean)

Parameters

allowRedirectInIframe

boolean

Config value to allow redirects when app is inside an iframe

blockReloadInHiddenIframes()

Throws error if we have completed an auth and are attempting another auth request inside an iframe.

function blockReloadInHiddenIframes()

clearHash(Window)

Clears hash from window url.

function clearHash(contentWindow: Window)

Parameters

contentWindow

Window

createGuid()

Wrapper function that creates a UUID v7 from the current timestamp.

function createGuid(): string

Returns

string

getCurrentUri()

Returns current window URL as redirect uri

function getCurrentUri(): string

Returns

string

getHomepage()

Gets the homepage url for the current window location.

function getHomepage(): string

Returns

string

isInIframe()

Returns boolean of whether the current window is in an iframe or not.

function isInIframe(): boolean

Returns

boolean

isInPopup()

Returns boolean of whether or not the current window is a popup opened by msal

function isInPopup(): boolean

Returns

boolean

preconnect(string)

Adds a preconnect link element to the header which begins DNS resolution and SSL connection in anticipation of the /token request

function preconnect(authority: string)

Parameters

authority

string

preflightCheck(boolean)

Helper to validate app environment before making an auth request

function preflightCheck(initialized: boolean)

Parameters

initialized

boolean

redirectPreflightCheck(boolean, BrowserConfiguration)

Helper to validate app enviornment before making redirect request

function redirectPreflightCheck(initialized: boolean, config: BrowserConfiguration)

Parameters

initialized

boolean

config

BrowserConfiguration

replaceHash(string)

Replaces current hash with hash from provided url

function replaceHash(url: string)

Parameters

url

string