de-vraag
  • Pertanyaan
  • Tag
  • Pengguna
Notifikasi
Imbalan
Registrasi
Setelah Anda mendaftar, Anda akan diberitahu tentang balasan dan komentar untuk pertanyaan Anda.
Gabung
Jika Anda sudah memiliki akun, masuk untuk memeriksa pemberitahuan baru.
Akan ada hadiah untuk pertanyaan, jawaban, dan komentar tambahan.
Lebih
Sumber
Sunting
Adhip Gupta
Adhip Gupta
Question

Alamat MAC dalam JavaScript

Saya tahu bahwa kita bisa mendapatkan alamat MAC pengguna melalui IE (objek ActiveX).

Apakah ada cara untuk mendapatkan alamat MAC pengguna menggunakan JavaScript?

93 2008-08-06T13:43:44+00:00 6
 p.campbell
p.campbell
Pertanyaan edit 17 Maret 2017 в 5:52
Pemrograman
javascript
mac-address
 GateKiller
GateKiller
6 Agustus 2008 в 1:45
2008-08-06T13:45:00+00:00
Lebih
Sumber
Sunting
#8408825

Jawaban cepat dan sederhana adalah Tidak.

Javascript adalah bahasa tingkat tinggi dan tidak memiliki akses ke informasi semacam ini.

52
0
Solution / Answer
Grey Panther
Grey Panther
14 Agustus 2008 в 6:21
2008-08-14T06:21:12+00:00
Lebih
Sumber
Sunting
#8408829

I concur with all the previous answers that it would be a privacy/security vulnerability if you would be able to do this directly from Javascript. There are two things I can think of:

  • Using Java (with a signed applet)
  • Using signed Javascript, which in FF (and Mozilla in general) gets higher privileges than normal JS (but it is fairly complicated to set up)
52
0
Vincent Robert
Vincent Robert
11 Agustus 2008 в 4:34
2008-08-11T16:34:49+00:00
Lebih
Sumber
Sunting
#8408828

No you cannot get the MAC address in JavaScript, mainly because the MAC address uniquely identifies the running computer so it would be a security vulnerability.

Now if all you need is a unique identifier, I suggest you create one yourself using some cryptographic algorithm and store it in a cookie.

If you really need to know the MAC address of the computer AND you are developing for internal applications, then I suggest you use an external component to do that: ActiveX for IE, XPCOM for Firefox (installed as an extension).

27
0
 Seibar
Seibar
6 Agustus 2008 в 3:38
2008-08-06T15:38:50+00:00
Lebih
Sumber
Sunting
#8408827

Tidak. Alasan ActiveX dapat melakukannya adalah karena ActiveX adalah aplikasi kecil yang berjalan pada mesin klien.

Saya akan membayangkan akses ke informasi tersebut melalui JavaScript akan menjadi kerentanan keamanan.

6
0
Ryan Ahearn
Ryan Ahearn
6 Agustus 2008 в 1:51
2008-08-06T13:51:52+00:00
Lebih
Sumber
Sunting
#8408826

Jika ini untuk aplikasi intranet dan semua klien menggunakan DHCP, Anda dapat meminta server DHCP untuk alamat MAC untuk alamat IP yang diberikan.

4
0
Ad Kahn
Ad Kahn
5 Januari 2018 в 11:22
2018-01-05T11:22:54+00:00
Lebih
Sumber
Sunting
#8408830

i was looking for the same problem and stumbled upon the following code.

How to get Client MAC address(Web):

To get the client MAC address only way we can rely on JavaScript and Active X control of Microsoft.It is only work in IE if Active X enable for IE. As the ActiveXObject is not available with the Firefox, its not working with the firefox and is working fine in IE.

This script is for IE only:

function showMacAddress() {
    var obj = new ActiveXObject("WbemScripting.SWbemLocator");
    var s = obj.ConnectServer(".");
    var properties = s.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
    var e = new Enumerator(properties);
    var output;
    output = '<table border="0" cellPadding="5px" cellSpacing="1px" bgColor="#CCCCCC">';
    output = output + '<tr bgColor="#EAEAEA"><td>Caption</td><td>MACAddress</td></tr>';
    while (!e.atEnd()) {
        e.moveNext();
        var p = e.item();
        if (!p) continue;
        output = output + '<tr bgColor="#FFFFFF">';
        output = output + '<td>' + p.Caption; +'</td>';
        output = output + '<td>' + p.MACAddress + '</td>';
        output = output + '</tr>';
    }
    output = output + '</table>';
    document.getElementById("box").innerHTML = output;
}

showMacAddress();
<div id='box'></div>
 ntfs.hard
ntfs.hard
Jawaban edit 7 Oktober 2019 в 6:19
4
0
Related communities 1
JavaScript Indonesia
JavaScript Indonesia
14 549 pengguna
Grup JavaScript yang membahas JavaScript, framework JS, dan Node JS secara universal. Cek Pinned Message untuk keterangan lebih lanjut. Komunitas ReactJS: https://t.me/react_idn
Buka telegram
Tambahkan pertanyaan
Kategori
Semua
Teknologi
Budaya / Rekreasi
Kehidupan / Seni
Ilmu Pengetahuan
Profesional
Bisnis
Pengguna
Semua
Baru
Populer
1
Галина Утяшова
Terdaftar 20 jam yang lalu
2
Asilbek Qadamboyev
Terdaftar 4 hari yang lalu
3
Akshit Mehta
Terdaftar 6 hari yang lalu
4
me you
Terdaftar 1 minggu yang lalu
5
Никита иванов
Terdaftar 1 minggu yang lalu
ID
JA
RU
© de-vraag 2022
Sumber
stackoverflow.com
di bawah lisensi cc by-sa 3.0 dengan atribusi