Difference between revisions of "Global JavaScript Variables"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 17: Line 17:
:::<syntaxhighlight lang="javascript" enclose="div">
:::<syntaxhighlight lang="javascript" enclose="div">
encodeURIComponent(lj_window_src)
encodeURIComponent(lj_window_src)
</syntaxhighlight>
</syntaxhighlight><noinclude>
<noinclude>


[[Category:JavaScript APIs]]
[[Category:JavaScript APIs]]
</noinclude>
</noinclude>

Revision as of 00:33, 22 May 2014

The following JavaScript variables are global. They are available in all JavaScript code running on the platform.

Considerations
  • Variable names are case-sensitive
  • In a Site, no one is logged in, and the page is not running on the platform, so the variables have no meaning in that context.

User Variables

  • LJUserName - Name of the (logged in) User
  • LJPrimaryTeamName - Name of the user's Primary Team
  • LJPrimaryTeamRoleName - Name of the user's Role

Page Variables

lj_window_src
Contains the URL of the current page. (Needs to be URL encoded when used.)
Sample Usage
<syntaxhighlight lang="javascript" enclose="div">

encodeURIComponent(lj_window_src) </syntaxhighlight>