Wednesday, October 2, 2013

Global javascript variables on PWA pages


Global variable user NT Account on Project Server PWA pages


On all Project server PWA site pages (but not in custom application pages from _layouts), go to ViewSource, you will find client script block rendered in the HTML DOM. See the highlighted to javascript variable.

1 <SCRIPT type='text/javascript'> 2 var g_sProtocol = 'http:'; 3 var g_fIsRTL = false; 4 var g_fIsNTLogon = 1; 5 var g_sUserName = PJUnescape('domain%5Cjohndoe'); 6 var g_fSuppressWCAlert = false; 7 var g_nSimpleUI = 0; 8 var g_nPageLCID = 1033; 9 var g_PageCulture = 'en-US'; 10 </SCRIPT>

So if you have any JavaScript code through Content Editor webpart, the variable g_sUserName is readily available for use in the code. You may need to use inbuilt JavaScript function escape(g_sUserName) to get the actual string out. 

No comments:

Post a Comment