2015-02-17

Recently noticed that the SharePoint online has some built in JS module to detect the type of browser and modules to access the browser storage which can be used instead of relying on third party or custom code.

Browser Detection:

Init.js has a module “BrowserDetection” to determine the type of browser.  The same can be accessed using the “browseris” variable.

i.e. browseris.mac or BrowserDetection.useragent.mac etc. The below screenshot displays the  BrowserDetection.useragent object available properties.

Browser Storage:

Init.js has a wrapper module to access the browser storage area. The below picture displays all the properties / methods available to access the browser local or session storage area. For more details about the browser storage can be found here.

Example:

  • BrowserStorage.local.setItem(“MyLocalKey”,”O365″) sets the value in the local storage.

  • BrowserStorage.local.getItem(“MyLocalKey”) retrieves the value from the local storage.

About the author 

Balamurugan Kailasam