Skip to main content

Hi, one of my valued customers is looking to access browser local storage variables with Apex Classes in LWC.  They would like to know how to import Browser properties modules, or if there is any other alternate approach to get local storage properties within Lwc js file.

 

Their code sample is  below, which they are trying to execute in js file, which throws  a null value or undefined.

 

window.localStorage.getItem('sessionid')

localStorage.getItem(‘sessionid’)

 

Note that the sessionid value is not stored with in Lwc, its already set outside of salesforce components, but we are trying to access that value with in Lwc.

 

Thanks in Advance!

 

@Sham Rajendra 

0/9000