BrowserUtils class
Utility class for browser specific functions
Methods
block |
Block redirectUri loaded in popup from calling AcquireToken APIs |
block |
Throws error if native brokering is enabled but initialize hasn't been called |
block |
Throws error if token requests are made in non-browser environment |
block |
Block redirect operations in iframes unless explicitly allowed |
block |
Throws error if we have completed an auth and are attempting another auth request inside an iframe. |
clear |
Clears hash from window url. |
detect |
Returns boolean of whether current browser is an Internet Explorer or Edge browser. |
get |
Returns best compatible network client object. |
get |
Returns current window URL as redirect uri |
get |
Gets the homepage url for the current window location. |
is |
Returns boolean of whether the current window is in an iframe or not. |
is |
Returns boolean of whether or not the current window is a popup opened by msal |
replace |
Replaces current hash with hash from provided url |
Method Details
blockAcquireTokenInPopups()
Block redirectUri loaded in popup from calling AcquireToken APIs
static function blockAcquireTokenInPopups()
blockNativeBrokerCalledBeforeInitialized(boolean, boolean)
Throws error if native brokering is enabled but initialize hasn't been called
static function blockNativeBrokerCalledBeforeInitialized(allowNativeBroker: boolean, initialized: boolean)
Parameters
- allowNativeBroker
-
boolean
- initialized
-
boolean
blockNonBrowserEnvironment(boolean)
Throws error if token requests are made in non-browser environment
static function blockNonBrowserEnvironment(isBrowserEnvironment: boolean)
Parameters
- isBrowserEnvironment
-
boolean
Flag indicating if environment is a browser.
blockRedirectInIframe(InteractionType, boolean)
Block redirect operations in iframes unless explicitly allowed
static function blockRedirectInIframe(interactionType: InteractionType, allowRedirectInIframe: boolean)
Parameters
- interactionType
- InteractionType
Interaction type for the request
- 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.
static function blockReloadInHiddenIframes()
clearHash(Window)
Clears hash from window url.
static function clearHash(contentWindow: Window)
Parameters
- contentWindow
-
Window
detectIEOrEdge()
Returns boolean of whether current browser is an Internet Explorer or Edge browser.
static function detectIEOrEdge(): boolean
Returns
boolean
getBrowserNetworkClient()
Returns best compatible network client object.
static function getBrowserNetworkClient(): INetworkModule
Returns
INetworkModule
getCurrentUri()
Returns current window URL as redirect uri
static function getCurrentUri(): string
Returns
string
getHomepage()
Gets the homepage url for the current window location.
static function getHomepage(): string
Returns
string
isInIframe()
Returns boolean of whether the current window is in an iframe or not.
static function isInIframe(): boolean
Returns
boolean
isInPopup()
Returns boolean of whether or not the current window is a popup opened by msal
static function isInPopup(): boolean
Returns
boolean
replaceHash(string)
Replaces current hash with hash from provided url
static function replaceHash(url: string)
Parameters
- url
-
string