Regarding Site properties usage in Javascript under Scripts in mobile application

Regarding Site properties usage in Javascript under Scripts in mobile application

  

Hi,

I am trying to use a site property inside a script, but unable to do for mobile.This script gets loaded with the launch of the first page. Can you please guide me with a way to use a site property inside the script in a mobile application or an alternate way to load a script using a site property?


Hi Avala,

Site-properties are server-side variables, and are not available client-side. This also goes for Web Apps. In Mobile Apps, site-properties unfortunately can't be used at all. You could however create a Server Action that returns the value of a Site-property, call that in the OnReady or the like, and cache the value locally.

Hi Avala,

Site properties are server-side, while Javascript code is, obviously, client-side. So to use a site property inside Javascript you have to first get its value through a Server Action. You then have to store that value locally so that it's available to your Javascript code. To store it and then access it from your JS code, you could use something like sessionStorage. You just have to make sure that the code that gets the value of the site property and stores it runs before the code that uses it.