×Welcome aboard! We are happy you are here and wish you good net-raft!



Together We Can Simplify The World
Just a Web Code Solution

the current number of solutions:  2529

You Can Join us too!

it news shareTrending in the Internet industry

Discover and Share trending in the Internet industry from all around the world.
Click to see more ...

  19     276

how to get client machine name and user name using angularjs ?

(angularjs client machine name user)

- ANGULARJS

 2326

created: 16 months agoANGULARJS

0

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">

<script src="//code.angularjs.org/snapshot/angular.min.js "></script>

</head>

<body ng-app="getname">

<script>

angular.module('getname', [])
.controller('myname', ['$scope', function ($scope) {
var ax = new ActiveXObject("WScript.Network");
$scope.name = 'User: ' + ax.UserName + ' Computer: ' + ax.ComputerName;
} ]);

</script>

<div ng-controller="myname">

<span>{{name}}</span>

</div>

</body>
</html>

     

The power of the user (%)

15%

created: 12 months agoANGULARJS

2

// this is the only solution, works only for IE in intranet or local machine, there is a security reason
// you can try node.js https://net-raft.com/Questions/1567/how-to-get-client-machine-name-and-computer-name-with-nodejs/1567

try
{
var ax = new ActiveXObject("WScript.Network");
alert('User: ' + ax.UserName );
alert('Computer: ' + ax.ComputerName);
}
catch (e)
{
alert('Permission to access computer name is denied');
}

});


     

The power of the user (%)

10%

created: 5 months agoANGULARJS

2

// important : ActiveXObject works only for IE (new ActiveXObject("ADODB.Connection"))

     

The power of the user (%)

74%

created: 2 months agoANGULARJS

4

// this one is for angular. You get hostname.
// app.component.ts

import { Component, OnInit, Inject, Injectable } from '@angular/core';
import { DOCUMENT } from '@angular/platform-browser';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {

hostname:any;
domain:any;
constructor(@Inject(DOCUMENT) private document: any) { }

ngOnInit() {
this.domain = this.document.location.hostname;
this.hostname = this.domain;
}
}

// app.component.html

<div style="text-align:center">
<h1>
{{hostname}}
</h1>
</div>

     

The power of the user (%)

5%



The most helpful ANGULARJS solutions

How to get client ip address using angularjs ?How to get client ip address using angularjs ?ANGULARJS

Click to see more ...

  6.5K     1.8K

How to get city from ip address with angularjs ?How to get city from ip address with angularjs ?ANGULARJS

Click to see more ...

  2.5K     1.1K

how to get client machine name and user name using angularjs ?how to get client machine name and user name using angularjs ?ANGULARJS

Click to see more ...

  2.3K     579

get client country using angularjs ?get client country using angularjs ?ANGULARJS

Click to see more ...

  1.2K     460

How to get local client ip address using angularjs ?How to get local client ip address using angularjs ?ANGULARJS

Click to see more ...

  1.5K     412

get region angularjsget region angularjsANGULARJS

Click to see more ...

  1K     409

how to fill a list from an another file in json format using angularjs ?how to fill a list from an another file in json format using angularjs ?ANGULARJS

Click to see more ...

  663     341

How to get value from a href using angularjs ?How to get value from a href using angularjs ?ANGULARJS

Click to see more ...

  739     248

How to get keycode using angularjs ?How to get keycode using angularjs ?ANGULARJS

Click to see more ...

  536     150

get client time zone using angularjs get client time zone using angularjs ANGULARJS

Click to see more ...

  275     139