Question

I have a desktop app built with TideSDK and java script.

The idea is to use system login to autologin ot the tideSDK app. I have tried following code snippet to get the system login username.

var WinNetwork = new ActiveXObject("WScript.Network");    //option 1 ref http://stackoverflow.com/questions/2968690/get-windows-username-with-javascript
console.log(WinNetwork);

var userName = @HttpContext.Current.User.Identity.Name;   //option 2 ref http://stackoverflow.com/questions/12820172/how-to-get-the-current-login-user-name-in-my-script-file-inside-my-asp-net-mvc

In the option 1 it says ActiveXObject is not available.

In the option 2 it gives a parse error

SyntaxError: Parse error

Invoking masonry    /C:/ProgramData/TideSDK/modules/win32/ui/1.3.1%2Dbeta/ui.js:95

Option 1 may not work on anything other than IE.

What's wrong I am doing with option 2?

Is there any other way to get system user name from TideSDK app?

Was it helpful?

Solution

The TideSDK provides it's own way to solve this.

just use

<script type="text/javascript">
    var username = Ti.Platform.getUsername();
    console.log(username);
</script>

That will give the username of current system login

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top